home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / etc / xemacs-internals < prev    next >
Encoding:
Text File  |  1994-09-20  |  162.8 KB  |  4,313 lines

  1. Notes on the inner workings of XEmacs
  2.  
  3.  
  4. ----------------------------------------------------------------------
  5. ---------------------------- allocation ------------------------------
  6. ----------------------------------------------------------------------
  7.  
  8. 1. Lowest-level allocation:
  9.  
  10.   Lisp_Object malloc_warning_1 (str) 
  11.   void malloc_warning (str) 
  12.   memory_full () 
  13.   long * xmalloc (size) 
  14.   long * xrealloc (block, size) 
  15.  
  16. xmalloc() and xrealloc() call malloc() and realloc(), and if the result
  17. returned is 0 (no free memory), call memory_full().  malloc_warning() is
  18. called by malloc() when there is almost no free memory, and in turn calls
  19. malloc_warning_1() to issue a warning to the user.  Note that Emacs has its
  20. own malloc(), realloc(), and free() defined in malloc.c.
  21.  
  22. 2. General:
  23.  
  24. VALIDATE_LISP_STORAGE(address, size)
  25. INCREMENT_CONS_COUNTER(size)
  26. int consing_since_gc;
  27. int gc_cons_threshold;
  28.  
  29. /* Nonzero during gc */
  30. int gc_in_progress;
  31.  
  32. /* Nonzero when calling the hooks in Energize-beta */
  33. Lisp_Object Qgc_currently_forbidden;
  34. int gc_currently_forbidden;
  35.  
  36. [some other stuff]
  37.  
  38. VALIDATE_LISP_STORAGE() is called whenever a new address is returned from
  39. malloc() that is supposed to go within a Lisp object.  It verifies that the
  40. address will actually fit (since Lisp addresses have to fit within 24 or 26
  41. bits) and calls memory_full() if not.  INCREMENT_CONS_COUNTER() is called
  42. whenever certain Lisp objects are created, and updates consing_since_gc, the
  43. number of bytes of Lisp objects created since the last garbage collection.
  44. When this number reaches gc_cons_threshold, a garbage collection is begun.
  45. [INCREMENT_CONS_COUNTER() optionally calls cadillac_record_backtrace(); what
  46. is this?]
  47.  
  48.  
  49. 3. Creation of primitive objects:
  50.  
  51.  
  52.  static void init_extents () 
  53.  EXTENT make_extent () 
  54.  DUP make_extent_replica () 
  55.  
  56. 3a. cons
  57.  
  58.  void init_cons () 
  59.   free_cons (ptr) 
  60.  DEFUN ("cons", Fcons, Scons, 2, 2, 0, "Create a new cons, give it CAR and CDR as components, and return it.") (car, cdr) 
  61. #define CONS_BLOCK_SIZE \
  62.   ((1020 - sizeof (struct cons_block *)) / sizeof (struct Lisp_Cons))
  63. struct cons_block
  64.   {
  65.     struct cons_block *next;
  66.     struct Lisp_Cons conses[CONS_BLOCK_SIZE];
  67.   };
  68.  
  69. struct cons_block *cons_block;
  70. int cons_block_index;
  71.  
  72. struct Lisp_Cons *cons_free_list;
  73.  
  74. Cons cells are stored in cons blocks (struct cons_block), which contain a
  75. "next" field and an array of conses.  cons blocks are calculated to occupy
  76. exactly 1024 bytes of memory including malloc info.  "cons_block" points to
  77. the first (most recent) cons block in the chain.  As cons cells are freed,
  78. they are added to the cons_free_list (threaded through the car field), and
  79. new cells are taken from this list first.  If no more such cells are
  80. available, a new is obtained from the current cons block (cons_block_index
  81. specifies the index of the next free cell), and if there are no free cells, a
  82. new cons block is created.  VALIDATE_LISP_STORAGE() and
  83. INCREMENT_CONS_COUNT() are called as necessary.  init_cons() creates the
  84. first cons block, and Fcons() and free_cons() create and free cons cells as
  85. indicated.
  86.  
  87. 3b. list
  88.  
  89.  DEFUN ("list", Flist, Slist, 0, MANY, 0, "Return a newly created list with specified arguments as elements.\n\ Any number of arguments, even zero arguments, are allowed.") (nargs, args) 
  90.  DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, "Return a newly created
  91. list of length LENGTH, with each element being INIT.") (length, init)
  92.  
  93. No surprises here.  Fmake_list() creates a list of specified length by
  94. calling Fcons() repeatedly and Flist() calls Fmake_list() and then traipses
  95. down the list, filling in the "car" fields.
  96.  
  97. 3c. float
  98.  
  99.  void init_float () 
  100.   free_float (ptr) 
  101.  Lisp_Object make_float (float_value) 
  102.  
  103. #define FLOAT_BLOCK_SIZE \
  104.   ((1020 - sizeof (struct float_block *)) / sizeof (struct Lisp_Float))
  105.  
  106. struct float_block
  107.   {
  108.     struct float_block *next;
  109.     struct Lisp_Float floats[FLOAT_BLOCK_SIZE];
  110.   };
  111.  
  112. struct float_block *float_block;
  113. int float_block_index;
  114.  
  115. struct Lisp_Float *float_free_list;
  116.  
  117. Floats are allocated exactly like cons cells above.  Floats on the free list
  118. are threaded through the "type" field.
  119.  
  120. 3d. vector
  121.  
  122. struct Lisp_Vector *all_vectors;
  123.  
  124.  DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, "Return a newly created vector of length LENGTH, with each element being INIT.\n\ See also the function `vector'.") (length, init) 
  125.  DEFUN ("vector", Fvector, Svector, 0, MANY, 0, "Return a newly created vector with specified arguments as elements.\n\ Any number of arguments, even zero arguments, are allowed.") (nargs, args) 
  126.  
  127. Each vector is allocated as a chunk of memory of the right size, and all
  128. vectors are kept on the list "all_vectors", threaded through the "next"
  129. field.  Note that "struct Lisp_Vector" appears to contain space for only one
  130. element.  However, indexing off the end of this array simply accesses the
  131. rest of the space allocated for the elements.
  132.  
  133. 3e. byte code objects
  134.  
  135. (DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
  136.   "Create a byte-code object with specified arguments as elements.\n\
  137. At least four arguments are required; only six have any significance.")
  138. (nargs, args) 
  139.  
  140. calls make_pure_vector(); [what does this do?]
  141.  
  142. 3f. symbols
  143.  
  144. #define SYMBOL_BLOCK_SIZE \
  145.   ((1020 - sizeof (struct symbol_block *)) / sizeof (struct Lisp_Symbol))
  146.  
  147. struct symbol_block
  148.   {
  149.     struct symbol_block *next;
  150.     struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
  151.   };
  152.  
  153. struct symbol_block *symbol_block;
  154. int symbol_block_index;
  155.  
  156. struct Lisp_Symbol *symbol_free_list;
  157.  
  158.  void init_symbol () 
  159.  DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, "Return a newly allocated uninterned symbol whose name is NAME.\n\ Its value and function definition are void, and its property list is nil.") (str) 
  160. #define MARKER_BLOCK_SIZE \
  161.   ((1020 - sizeof (struct marker_block *)) / sizeof (struct Lisp_Marker))
  162.  
  163. Symbols are allocated exactly like cons cells above.  The symbol's name is
  164. bound to the string given, the symbol's plist is bound to Qnil, and the
  165. function and value fields are marked unbound (bound to variable Qunbound).
  166. Symbols on the free list are threaded through the "next" field, which is also
  167. used for threading in an obarray.
  168.  
  169. 3g. markers
  170.  
  171. struct marker_block
  172.   {
  173.     struct marker_block *next;
  174.     struct Lisp_Marker markers[MARKER_BLOCK_SIZE];
  175.   };
  176.  
  177. struct marker_block *marker_block;
  178. int marker_block_index;
  179.  
  180. struct Lisp_Marker *marker_free_list;
  181.  
  182.  void init_marker () 
  183.  DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, "Return a newly
  184. allocated marker which does not point at any place.") () 
  185.  
  186. Markers are allocated exactly like cons cells above.  Markers on the free
  187. list are threaded through the "chain" field.
  188.  
  189. 3h. string
  190.  
  191.   static void init_strings () 
  192.   static struct Lisp_String * make_string_internal () 
  193.   static struct string_chars * allocate_string_chars (size, fullsize) 
  194.   static Lisp_Object make_uninit_string (length) 
  195.   DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, "Return a newly created string of length LENGTH, with each element being INIT.\n\ Both LENGTH and INIT must be numbers.") (length, init) 
  196.   Lisp_Object make_string_from_buffer (buf, index, length) 
  197.   Lisp_Object make_string (contents, length) 
  198.   Lisp_Object build_string (str) 
  199.   Lisp_Object make_pure_string (data, length) 
  200.  
  201. /* If SIZE is the length of a string, this returns how many bytes
  202.    the string occupies in a string_chars_block (including padding).  */
  203. #define PAD ((sizeof (struct Lisp_String *)) - 1)
  204. #define ROUND_UP_STRING_SIZE(s) (((s) + 1 + PAD) & ~PAD)
  205. #define STRING_FULLSIZE(size) \
  206. ROUND_UP_STRING_SIZE ((size) + sizeof (struct Lisp_String *))
  207.  
  208. #define STRING_BLOCK_SIZE \
  209. ((1020 - sizeof (struct string_block *)) / sizeof (struct Lisp_String))
  210. /* String blocks contain this many useful bytes.
  211.    8188 is power of 2, minus 4 for malloc overhead. */
  212. #define STRING_CHARS_BLOCK_SIZE \
  213. (8188 - ((2 * sizeof (struct string_chars_block *))+ sizeof (int)))
  214.  
  215. struct string_chars
  216. {
  217.   struct Lisp_String *string;
  218.   unsigned char chars[1];
  219. };
  220.  
  221. #define SLOT_OFFSET(type, slot_name) \
  222. ((unsigned) (((char *) (&(((type *)0)->slot_name))) - ((char *) 0)))
  223. #define CHARS_TO_STRING_CHAR(x) \
  224. ((struct string_chars *)\
  225.  (((char *) (x)) - (SLOT_OFFSET(struct string_chars, chars))))
  226.  
  227. /* Block header for small strings. */
  228. struct string_chars_block
  229. {
  230.   struct string_chars_block *next;
  231.   struct string_chars_block *prev;
  232.   int pos;
  233.   unsigned char chars[STRING_CHARS_BLOCK_SIZE];
  234. };
  235.  
  236. struct string_block
  237. {
  238.   struct string_block *next;
  239.   struct Lisp_String strings[STRING_BLOCK_SIZE];
  240. };
  241.  
  242. struct string_block *string_block;
  243. static int string_block_index;
  244. static struct Lisp_String *string_free_list;
  245.  
  246. struct string_chars_block *current_string_chars_block;
  247. struct string_chars_block *first_string_chars_block;
  248.  
  249. #define NONRELOCATING_STRING_SIZE(size) ((size) >= 1020)
  250. #define BIG_STRING_SIZE(size) (NONRELOCATING_STRING_SIZE(size))
  251.  
  252. struct Lisp_String
  253.   {
  254.     int size;
  255.     Lisp_Object dup_list;
  256.     unsigned char *data;
  257.   }
  258.  
  259. A string consists of a struct Lisp_String, plus the actual string data.
  260. The struct Lisp_String consists of the length of the string and a
  261. pointer to the data, plus a chain field "dup_list", used for threading
  262. the list of free struct Lisp_String's.  struct Lisp_String's are managed
  263. exactly like cons cells.  make_string_internal() returns a pointer to a
  264. new struct Lisp_String.
  265.  
  266. The string data itself is stored in struct string_chars_block's, if the
  267. string is less than a certain size (about 1K bytes).  A struct
  268. string_chars_block occupies exactly 8K bytes, and holds a certain amount
  269. of raw storage plus forward and backward link pointers and an index into
  270. the storage, indicating where the unused part starts.  The storage is
  271. chunked out in struct string_chars's, each of which consists of a
  272. pointer to the struct Lisp_String for this string plus the actual string
  273. data, padded out to a multiple of 4 bytes.  A new struct
  274. string_chars_block is allocated if the existing one does not have enough
  275. space, and all such structures are linked together and pointed to by
  276. first_string_chars_block and current_string_chars_block.
  277.  
  278. If the string is larger than about 1K bytes (see BIG_STRING_SIZE() and
  279. NONRELOCATING_STRING_SIZE()), a struct string_chars of the proper size
  280. is simply malloc()ed.
  281.  
  282. allocate_string_chars() allocates and returns a struct string_chars() of
  283. the proper size.  make_uninit_string() uses this function and
  284. make_string_internal(), and returns a Lisp_Object that points to a
  285. completed struct Lisp_String.  make-string, make_string(), and
  286. build_string() call make_uninit_string() and then fill in the data.
  287. make_string_from_buffer(), which makes a string from a section of a
  288. buffer's text, is similar but first moves the gap out the way and also
  289. calls replicate_extents() [see ?????] (see "buffers").
  290.  
  291.  
  292. 3i. pure
  293.  
  294.  Lisp_Object pure_cons (car, cdr) 
  295.   Lisp_Object make_pure_float (num) 
  296.   Lisp_Object make_pure_vector (len, stat_type) make_pure_vector (len) 
  297.  DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, "Make a copy of OBJECT in pure storage.\n\ Recursively copies contents of vectors and cons cells.\n\ Does not copy symbols.") (obj) 
  298.  
  299. 4. garbage collection
  300.  
  301.   void staticpro (varaddress) 
  302.     void BTL_before_Fgarbage_collect_stub () 
  303.  static void mark_object (), mark_buffer () static void mark_event (), mark_command_event_queue () static void clear_marks (), gc_sweep () static void compact_string_chars ()  static void mark_one_extent (extent) 
  304.   static void mark_extents (extent) 
  305.    static void mark_object (objptr) 
  306.   static void mark_buffer (buffer) 
  307.   static void mark_event (ptr) 
  308.   static void mark_command_event_queue () 
  309.   static void gc_sweep () 
  310.   static void compact_string_chars () 
  311.  DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", "Reclaim storage for Lisp objects no longer needed.\n\ Returns info on amount of space in use:\n\ ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\ (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS\n\ (USED-FLOATS . FREE-FLOATS) (USED-EVENTS . FREE-EVENTS))\n\ Garbage collection happens automatically if you cons more than\n\ `gc-cons-threshold' bytes of Lisp data since previous garbage collection.") () 
  312.   init_alloc_once () 
  313.  init_alloc () 
  314.  void syms_of_alloc () 
  315.  
  316. Garbage collection involves going through all referenceable memory and
  317. marking it, and then freeing all unreferenceable memory.  Garbage
  318. collection can happen any time anything is evaluated.  If a function
  319. creates a cons cell or anything else that is allocated and then calls
  320. any function that might directly or indirectly call Feval(), it must
  321. "protect" or "gcpro" that object; this involves putting it on a list of
  322. referenced objects that garbage-collect pays attention to.  The object
  323. must be ungcpro'ed when done.  The macros GCPRO1(), GCPRO2(), GCPRO3(),
  324. and GCPRO4() protect that many objects, and use local variables struct
  325. gcpro gcpro1, gcpro2, gcpro3, and gcpro4, which must have been declared
  326. at the top of the function.  These macros actually store the address of
  327. the passed object(s) into the appropriate struct gcpro(s) and add the
  328. structure(s) onto the head of the linked list pointed to by "gcprolist".
  329. The reason for storing the addresses, and not the objects themselves, is
  330. so that the variables holding the objects can be modified if the object
  331. is relocated, and also so that things still work correctly if you change
  332. the value of the variable holding the object.  Consequently, you must
  333. give lvalues as arguments to GCPRO*().  UNGCPRO() removes the struct
  334. gcpro's off the list.
  335.  
  336. staticpro() is similar to GCPRO() for global and static variables and
  337. adds an entry to the array staticvec[].
  338.  
  339. Garbage collection looks in the following places to find referenced
  340. memory:
  341.  
  342. 1) variables on the staticvec[] list, added with staticpro().
  343. 2) variables on the gcprolist.
  344. 3) objects in any backtrace structures on the backtrace_list. (see "eval")
  345. 4) specpdl
  346. 5) catchlist
  347. 6) handlerlist
  348. 7) any objects referenced by objects discovered above (e.g. if a cons is
  349. referenced, then its car and cdr are also referenced).
  350.  
  351. Note that all symbols in the obarray (i.e. all global symbols) are
  352. marked, because (1) obarray (a vector) is staticpro'd, (2) when marking
  353. a vector all its elements are marked, and (3) when marking a symbol, the
  354. symbol pointed to by the "next" field is marked.  The next field is used
  355. to link together symbols on the free list, but for in-use symbols is
  356. always 0 unless the symbol is in an obarray.
  357.  
  358. ----------------------------------------------------------------------
  359. ----------------------------- bitmaps --------------------------------
  360. ----------------------------------------------------------------------
  361.  
  362.  
  363.  
  364. ----------------------------------------------------------------------
  365. ----------------------------- buffers --------------------------------
  366. ----------------------------------------------------------------------
  367.  
  368. [buffer.c, buffer.h]
  369.  
  370. struct buffer_text
  371.   {
  372.     unsigned char *beg;        /* Actual address of buffer contents. */    
  373.     int begv;            /* Index of beginning of accessible range. */
  374.     int pt;            /* Position of point in buffer. */
  375.     int gpt;            /* Index of gap in buffer. */
  376.     int zv;            /* Index of end of accessible range. */
  377.     int z;            /* Index of end of buffer. */
  378.     int gap_size;        /* Size of buffer's gap */
  379.     int modiff;            /* This counts buffer-modification events
  380.                    for this buffer.  It is incremented for
  381.                    each such event, and never otherwise
  382.                    changed.  */
  383.     int face_change;        /* This is set when a change in how the text
  384.                    should be displayed (e.g., font, color)
  385.                    is made. */
  386.   };
  387.  
  388. struct buffer
  389.   {
  390.     /* Everything before the `name' slot must be of a non-Lisp_Object type,
  391.        and every slot after `name' must be a Lisp_Object.
  392.  
  393.        Check out mark_buffer (alloc.c) to see why.
  394.      */
  395.  
  396.     /* This structure holds the coordinates of the buffer contents.  */
  397.     struct buffer_text text;
  398.  
  399.     /* Next buffer, in chain of all buffers including killed buffers.
  400.        This chain is used only for garbage collection, in order to
  401.        collect killed buffers properly.  */
  402.     struct buffer *next;
  403.  
  404.     /* Flags saying which DEFVAR_PER_BUFFER variables
  405.        are local to this buffer.  */
  406.     int local_var_flags;
  407.  
  408.     /* Value of text.modiff when buffer last saved */
  409.     int save_modified;
  410.  
  411.     /* Set to the modtime of the visited file when read or written.
  412.        -1 means visited file was nonexistent.
  413.        0 means visited file modtime unknown; in no case complain
  414.        about any mismatch on next save attempt.  */
  415.     int modtime;
  416.  
  417.     /* the value of text.modiff at the last auto-save. */
  418.     int auto_save_modified;
  419.  
  420.     /* Position in buffer at which display started
  421.        the last time this buffer was displayed */
  422.     int last_window_start;
  423.  
  424.     struct stack_of_extents *cached_stack;
  425.  
  426.     /* These next two are exceptions -- both slots are be handled 
  427.        "specially" by gc_sweep, and their contents are not lisp-accessible 
  428.        as a local variable, but they are Lisp_Objects. */
  429.  
  430.     /* The markers that refer to this buffer.  This
  431.        is actually a single marker -- successive elements in its marker
  432.        `chain' are the other markers referring to this buffer */
  433.     Lisp_Object markers;
  434.  
  435.     /* Active regions in this buffer. */
  436.     Lisp_Object extents;
  437.  
  438.     /* Everything from here down must be a Lisp_Object */
  439.  
  440.     /* the name of this buffer */
  441.     Lisp_Object name;
  442. #undef MARKED_SLOT
  443. #define MARKED_SLOT(x) Lisp_Object x
  444. #include "bufslots.h"
  445. };
  446.  
  447. bufslots.h:
  448.  
  449.  
  450.     /* the name of the file associated with this buffer */
  451.     MARKED_SLOT (filename);
  452.  
  453.     /* the truename of the filename (via the realpath() system call) */
  454.     MARKED_SLOT (truename);
  455.  
  456.     /* Dir for expanding relative pathnames */
  457.     MARKED_SLOT (directory);
  458.  
  459.     /* true iff this buffer has been been backed
  460.        up (if you write to its associated file
  461.        and it hasn't been backed up, then a
  462.        backup will be made) */
  463.     MARKED_SLOT (backed_up);
  464.  
  465.     /* Length of file when last read or saved. */
  466.     MARKED_SLOT (save_length);
  467.  
  468.     /* file name used for auto-saving this buffer */
  469.     MARKED_SLOT (auto_save_file_name);
  470.  
  471.     /* Non-nil if buffer read-only */
  472.     MARKED_SLOT (read_only);
  473.  
  474.     /* "The mark"; no longer allowed to be nil */
  475.     MARKED_SLOT (mark);
  476.  
  477.     /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER)
  478.        for all per-buffer variables of this buffer.  */
  479.     MARKED_SLOT (local_var_alist);
  480.  
  481.     /* Symbol naming major mode (eg lisp-mode) */
  482.     MARKED_SLOT (major_mode);
  483.  
  484.     /* Pretty name of major mode (eg "Lisp") */
  485.     MARKED_SLOT (mode_name);
  486.  
  487.     /* Format string for mode line */
  488.     MARKED_SLOT (mode_line_format);
  489.  
  490.     /* Keys that are bound local to this buffer */
  491.     MARKED_SLOT (keymap);
  492.     /* Local bindings for mouse buttons, expressed as a keymap.  */
  493.     MARKED_SLOT (mouse_map);
  494.     /* Local bindings for function keys. */
  495.     MARKED_SLOT (function_key_map);
  496.     /* This buffer's local abbrev table */
  497.     MARKED_SLOT (abbrev_table);
  498.     /* This buffer's syntax table. */
  499.     MARKED_SLOT (syntax_table);
  500.  
  501.     /* Values of several buffer-local variables.
  502.  
  503.        tab-width is buffer-local so that redisplay can find it
  504.        in buffers that are not current */
  505.     MARKED_SLOT (case_fold_search);
  506.     MARKED_SLOT (tab_width);
  507.     MARKED_SLOT (fill_column);
  508.     MARKED_SLOT (left_margin);
  509.  
  510.     /* Function to call when insert space past fill column */
  511.     MARKED_SLOT (auto_fill_function);
  512.  
  513.     /* String of length 256 mapping each char to its lower-case version.  */
  514.     MARKED_SLOT (downcase_table);
  515.     /* String of length 256 mapping each char to its upper-case version.  */
  516.     MARKED_SLOT (upcase_table);
  517.  
  518.     /* Non-nil means do not display continuation lines */
  519.     MARKED_SLOT (truncate_lines);
  520.     /* Non-nil means display ctl chars with uparrow */
  521.     MARKED_SLOT (ctl_arrow);
  522.     /* Non-nil means do selective display;
  523.        See doc string in syms_of_buffer (buffer.c) for details.  */
  524.     MARKED_SLOT (selective_display);
  525. #ifndef old
  526.     /* Non-nil means show ... at end of line followed by invisible lines.  */
  527.     MARKED_SLOT (selective_display_ellipses);
  528. #endif
  529.     /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
  530.     MARKED_SLOT (minor_modes);
  531.     /* t if "self-insertion" should overwrite */
  532.     MARKED_SLOT (overwrite_mode);
  533.     /* non-nil means abbrev mode is on.  Expand abbrevs automatically. */
  534.     MARKED_SLOT (abbrev_mode);
  535.  
  536.     /* Display table to use for text in this buffer. */
  537.     MARKED_SLOT (display_table);
  538.     /* Translate table for case-folding search.  */
  539.     MARKED_SLOT (case_canon_table);
  540.     /* Inverse translate (equivalence class) table for case-folding search.  */
  541.     MARKED_SLOT (case_eqv_table);
  542.  
  543.     /* Changes in the buffer are recorded here for undo.
  544.        t means don't record anything.  */
  545.     MARKED_SLOT (undo_list);
  546.  
  547.     /* A redundant copy of text.pt, in the form of a marker.  Every time one
  548.        is updated, so is the other.
  549.      */
  550.     MARKED_SLOT (point_marker);
  551.  
  552.     /* If dedicated_screen is non-nil, display_buffer tries to use it instead
  553.        of the current screen */
  554.     MARKED_SLOT (dedicated_screen);
  555.  
  556. -------
  557.  
  558. Vbuffer_alist, a Lisp object, holds an assoc-list mapping strings (buffer
  559. names) to buffer objects.  Furthermore, each screen contains its own
  560. buffer_alist, which holds the same information but possibly in a
  561. different order.
  562.  
  563. Fbuffer_list(), Fget_buffer(), and Fget_file_buffer() do the expected
  564. things, working on the buffer list(s).  push_buffer_alist() and
  565. delete_from_buffer_alist() add to the end of or delete from all the
  566. buffer lists.
  567.  
  568. struct buffer holds all the info for a buffer.  This includes struct
  569. buffer_text (which holds the actual text), built-in buffer-local
  570. variables, plus various other things.  Each struct buffer is separately
  571. malloc'ed() and all allocated buffers are linked together through the
  572. field "next".
  573.  
  574. A pointer to the current buffer is contained in "current_buffer".
  575.  
  576. struct buffer_text:
  577.  
  578. The text in a buffer is maintained consecutively in memory, with the
  579. exception of a "gap" somewhere in the text.  Inserting text is done by
  580. moving the gap to the right place in the text and then copying the text
  581. in.  If the gap is too small to hold the text, it is enlarged and all the
  582. following text is moved to accommodate it.  Since this is an expensive
  583. operation, the size of the new gap is made quite large (specifically,
  584. 2000 plus one-tenth the size of the buffer).  This is very efficient when
  585. there is a lot of locality in the insertion, and has the advantage that
  586. accessing the character at a particular position is still relatively
  587. easy.
  588.  
  589. When text is deleted, a similar process is followed -- the gap is moved
  590. to where the deletion should occur and is enlarged appropriately.  There
  591. is currently no limit on the size of the gap, meaning that memory
  592. allocated for a buffer will never be freed until the buffer is killed.
  593. [does it happen even then?]
  594.  
  595. When inserting and deleting text, it is also necessary to change the
  596. various positions and markers.
  597.  
  598. The elements of struct buffer_text are:
  599.  
  600. struct buffer_text
  601.   {
  602.     unsigned char *beg;        /* Actual address of buffer contents. */    
  603.     int begv;            /* Index of beginning of accessible range. */
  604.     int pt;            /* Position of point in buffer. */
  605.     int gpt;            /* Index of gap in buffer. */
  606.     int zv;            /* Index of end of accessible range. */
  607.     int z;            /* Index of end of buffer. */
  608.     int gap_size;        /* Size of buffer's gap */
  609.     int modiff;            /* This counts buffer-modification events
  610.                    for this buffer.  It is incremented for
  611.                    each such event, and never otherwise
  612.                    changed.  */
  613.     int face_change;        /* This is set when a change in how the text
  614.                    should be displayed (e.g., font, color)
  615.                    is made. */
  616.   };
  617.  
  618. Note that character indices into buffers begin at 1.
  619.  
  620. Numerous macros are defined to make accessing the above fields easier:
  621.  
  622. BUF_CHAR_ADDRESS(buf, pos) and CHAR_ADDRESS(pos) [for the current buffer]
  623. return the address of the character specified by the given index.  They
  624. call BUF_TRUE_POS(buf, pos), which adjusts a character index by the
  625. appropriate amount if it is after the gap.  PTR_CHAR_POS(pos) [for the
  626. current buffer], reverses this process and returns the index
  627. corresponding to the given address.  BUF_CHAR_AT(buf, pos) and
  628. CHAR_AT(pos) return the actual character at the given index.
  629.  
  630. BEGV, PT, GPT, ZV, Z, MODIFF, GAP_SIZE, and FACECHANGE access the
  631. corresponding elements in the current buffer.  BEG and BEG_ADDR return
  632. the index and address of the beginning of the current buffer (note that
  633. BEG is always 1).  BEGV_ADDR, PT_ADDR, GPT_ADDR and ZV_ADDR return the
  634. addresses corresponding to the specified indices for the current buffer.
  635. GAP_END_ADDR returns the address of the character in the current buffer
  636. following the end of the gap.  Corresponding macros BUF_BEGV, BUF_PT,
  637. BUF_GPT, BUF_ZV, BUF_Z, BUF_MODIFF, BUF_GAP_SIZE, BUF_FACECHANGE,
  638. BUF_BEG, and BUF_BEG_ADDR work on a specified buffer.
  639.  
  640. [there's some more junk in buffer.h]
  641.  
  642. Manipulating the gap:
  643.  
  644.   void gap_left (pos, newgap)
  645.   void gap_right (pos)
  646.   void move_gap (pos)
  647.   void make_gap (increment)
  648.  
  649. move_gap() moves the gap the specified amount up or down, calling
  650. gap_left() or gap_right to do the work.  They work as expected, except
  651. that they (optionally) change beg_unchanged and end_unchanged [look these
  652. up], check for ^G every 32,000 characters [look up macro QUIT], and call
  653. adjust_markers() and adjust_extents() when done.
  654.  
  655. make_gap() increases the gap at least by the specified size, according to
  656. the formula above.  It calls BUFFER_REALLOC() to make more space and
  657. calls gap_left() to move the new "end gap" consecutive with the old gap,
  658. inhibiting ^G throughout.
  659.  
  660.  
  661. Inserting text:
  662.  
  663.   void insert_relocatable_raw_string (string, length, obj)
  664.   void insert_from_string (obj, pos, length)
  665.   void insert_raw_string (string, length)
  666.   void insert (string, length)
  667.   void insert_string (s)
  668.   void insert_char (c)
  669.   void insert_before_markers (string, length)
  670.   void insert_from_string_before_markers (string, pos, length)
  671.   void insert_buffer_string (b, index, length)
  672.  
  673. The two routines that actually insert text are
  674. insert_relocatable_raw_string() and insert_from_string().
  675. insert_raw_string(), insert(), insert_string(), and insert_char() do
  676. the same thing, the former two just calling
  677. insert_relocatable_raw_string() with a NULL pointer passed as obj, and
  678. the latter two just calling insert_raw_string() with the correct length.
  679.  
  680. void adjust_markers (from, to, amount)
  681.   void prepare_to_modify_buffer (start, end)
  682.  void modify_region (start, end)
  683.  static Lisp_Object before_change_function_restore (value)
  684.  static Lisp_Object after_change_function_restore (value)
  685.   signal_before_change (start, end)
  686.   signal_after_change (pos, lendel, lenins)
  687.   void del_range (from, to)
  688.  
  689. Creation of a new buffer is actually done in Fget_buffer_create().  
  690.  
  691.  
  692. ----------------------------------------------------------------------
  693. ------------------------------ display -------------------------------
  694. ----------------------------------------------------------------------
  695.  
  696. /* Nonzero if head_clip or tail_clip of current buffer has changed
  697.    since last redisplay that finished */
  698. int clip_changed;
  699.  
  700. /* Nonzero if window sizes or contents have changed
  701.    since last redisplay that finished */
  702. int windows_or_buffers_changed;
  703.  
  704. void mark_window_display_accurate(window, accurate_p)
  705.     Specifies whether
  706.  
  707. void redraw_screen(screen)
  708.     Sets up the screen for complete redisplay.  Physically clears the
  709.     screen and sets various flags to indicate that the entire contents
  710.     of the screen are garbaged.
  711.  
  712. redraw-screen
  713.     Lisp entry to redraw_screen().
  714.  
  715. redraw-display
  716.     Calls redraw-screen on all screens.
  717.  
  718. redisplay()
  719.     Main external entry point for redisplay.  Updates all screens on the
  720.     physical display.
  721.  
  722.     1) update_psheets()
  723.     2) in_display++
  724.     3) invalidate each screen's desired glyphs (reset the enable[] array).
  725.     4) deal with the echo area.
  726.     5) update the redisplay structure (desired glyphs):
  727.         a) if only local changes were made, take a shortcut.
  728.         b) otherwise redo the whole structure (redisplay_window()).
  729.     6) update the physical screen.  Calls update_screen() on any screens
  730.        that need to be updated.
  731.     7) mark the updated windows as accurate.
  732.     8) in_display--
  733.     9) update_screen_menubars()
  734.  
  735. redisplay_windows(window)
  736.     Redisplay the specified window and all the siblings after it.  Calls
  737.     redisplay_window().
  738.  
  739. redisplay_window(window, just_this_one)
  740.     Redisplay the specified window.  If this is a combination window,
  741.     redisplay all its children through redisplay_windows().  Does not
  742.     actually change the physical display.  Calls try_window() or
  743.     try_window_id().
  744.  
  745. try_window(window, pos)
  746.     Do a full redisplay on the specified window.  Does not actually change
  747.     the physical display.  Called by redisplay_window().
  748.  
  749. try_window_id(window)
  750.     Attempt to do a redisplay on the specified window when only local
  751.     changes happened.  Does not actually change the physical display.
  752.     Called by redisplay_window().
  753.  
  754. int update_screen(screen, force, inhibit_hairy_id)
  755.     Update a screen.  Essentially calls update_line() or x_update_line()
  756.     on each line.  Break off updating if input is pending, unless
  757.     "force" is non-zero.  Return value is non-zero is update broken off
  758.     due to pending input.
  759.  
  760.     1. if not "force" and input is pending, invalidate all the lines of
  761.        the screen's desired glyphs and return.
  762.     2. update_begin() (just sets updating_screen)
  763.     3. if ...
  764.     4. loop over all lines (possibly breaking if input pending) -- if the
  765.        line in desired glyphs is valid, display it with x_update_line()
  766.     5. set the cursor position properly
  767.     6. invalidate desired glyphs.
  768.     7. update_end()
  769.     8. deal with the termscript if necessary
  770.  
  771. void x_update_line(screen, vpos, pix_y)
  772.     Update line "vpos" on screen "screen".  "pix_y" is the position of
  773.     the top of the line, in pixels.  Calls x_write_glyphs(),
  774.     x_clear_display_line(), and x_clear_display_line_end() as necessary.
  775.  
  776.     1. save the characteristics for this line in current glyphs (for use
  777.        later on in this function)
  778.     2. move the characteristics in desired glyphs for this line into
  779.        current glyphs
  780.     3. if the line is blank, erase any line that might have been there
  781.        before (x_clear_display_line()) and return.
  782.     4. otherwise, attempt to do the minimum amount of effort to get a
  783.        correctly displayed line.  You figure out what's going on here.
  784.        I don't think it's robust.  x_clear_display_line(),
  785.        x_write_glyphs(), and/or x_clear_display_line_end() may be
  786.        called.
  787.  
  788. void x_clear_display_line(vpos, pix_width)
  789. void x_clear_display_line_end(vpos)
  790.  
  791.     Clear a line or part of a line.  Calls XClearArea().
  792.  
  793. int x_write_glyphs(screen, left, top, n, force_gc, box_p)
  794.  
  795.     The routine that actually draws text or a cursor.  "left" and "top"
  796.     specify the position in characters where the drawing starts.  "n"
  797.     specifies the number of characters to write. "box_p" specifies
  798.     whether to draw a box around the text.  ["force_gc"?]
  799.     Looks in "current_glyphs" to get text to write.
  800.  
  801.     1. If any parameters are invalid or something is wrong with
  802.        current_glyphs, return. (abort?)
  803.     2. Erase the cursor if it's in the region we're writing to.
  804.     3. Find the correct run.
  805.     4. Deal with graphics contexts. /** CHANGE **/
  806.     5. Find the correct place within the run; determine the pixel offset
  807.        where we should start displaying.
  808.     6. If the run to be displayed is text:
  809.         a. clear the area to be displayed in, if necessary.
  810.         b. display the text, displaying a box if necessary.  Apparently
  811.            deals with the background or whatever. [?]
  812.         c. deal with underlining. (this should be done in the callback
  813.            routine)
  814.     7. If the run to be displayed is "column_glyph":
  815.     8. If the run to be displayed is a "glyph" (bitmap), display the
  816.        bitmap.  Does some odd junk.
  817.     9. If the run to be displayed is "space":
  818.     10. Loop till all glyphs are displayed.
  819.  
  820. xx. displaying/removing the cursor
  821.  
  822. void erase_screen_cursor_if_needed(screen)
  823. void erase_cursor_if_needed(void)
  824. void erase_screen_cursor_if_needed_and_in_region(screen, x, y, n)
  825. void draw_screen_cursor_if_needed(screen)
  826. void x_screen_redraw_cursor(screen)
  827.  
  828.     Draw or erase a cursor, either for the specified screen or the
  829.     currently active screen (current_screen or updating_screen).
  830.     Possibly only remove cursor if it's on the specified line and
  831.     between character positions "x" and "x+n" inclusive.  Calls
  832.     x_display_cursor().
  833.  
  834. void x_display_bar_cursor(screen, on)
  835. int x_draw_empty_box(screen)
  836. int x_draw_square(screen)
  837. int x_erase_square(screen)
  838. int x_display_box_cursor(screen, on)
  839. int x_display_cursor(screen, on)
  840.  
  841.     Actually do the cursor displaying/removing.  Calls XClearArea() or
  842.     x_write_glyphs().
  843.  
  844. other:
  845.  
  846. x_draw_lineinfo_border()
  847. x_clear_lineinfo_glyph()
  848. XTwrite_glyphs()
  849. XTclear_end_of_line()
  850. XTclear_screen()
  851. XTflash()
  852. XTsimple_beep()
  853. XTring_bell()
  854. XTset_terminal_window()
  855. stufflines()
  856. scraplines()
  857. XTins_del_lines()
  858. repaint_lines()
  859. x_new_selected_screen()
  860. x_event_name()
  861. x_error_handler()
  862. x_IO_error_handler()
  863.  
  864. #ifdef ENERGIZE
  865. reasonable_glyph_index_p()
  866. allocate_x_bitmaps()
  867. possible_energize_glyph_index_p()
  868. allocate_x_bitmaps_index()
  869. free_all_x_bitmaps_indices()
  870. free_x_bitmaps_index()
  871. #endif
  872.  
  873. init_bitmap_tables()
  874. report_broken_pipe()
  875. make_argc_argv()
  876. make_arg_list()
  877. x_term_init()
  878. x_update_wm_hints()
  879. x_calc_absolute_position()
  880. x_set_offset()
  881. x_set_window_size()
  882. x_set_mouse_position()
  883. handle_raise_error()
  884. x_raise_screen()
  885. x_lower_screen()
  886. x_make_screen_visible()
  887. x_make_screen_invisible()
  888. x_iconify_screen()
  889. x_focus_screen()
  890. x_destroy_window()
  891.  
  892. ----------------------------------------------------------------------
  893. -------------------------------- eval --------------------------------
  894. ----------------------------------------------------------------------
  895.  
  896. struct backtrace
  897.   {
  898.     struct backtrace *next;
  899.     Lisp_Object *function;
  900.     Lisp_Object *args;        /* Points to vector of args. */
  901.     int nargs;            /* length of vector */
  902.                 /* if nargs is UNEVALLED, args points to
  903.                    slot holding list of unevalled args */
  904. #ifdef EMACS_BTL
  905.     /* The value of a Lisp integer that specifies the symbol being
  906.        "invoked" by this node in the backtrace, or 0 if the backtrace
  907.        doesn't correspond to a such an invocation */
  908.     int id_number;
  909. #endif
  910.     char evalargs;
  911.     char debug_on_exit;        /* Nonzero means call value of debugger
  912.                    when done with this operation. */
  913.   };
  914.  
  915. Feval() evaluates the form (a Lisp object) that is passed to it.  Note
  916. that evaluation is only non-trivial for two types of objects: symbols
  917. and conses.  Under normal circumstances (i.e. not mocklisp) a symbol is
  918. evaluated simply by calling symbol-value on it and returning the value.
  919.  
  920. Evaluating a cons means calling a function.  First, eval checks to see
  921. if garbage-collection is necessary, and calls Fgarbage_collect() if so.
  922. It then increases the evaluation depth by 1 (lisp_eval_depth and
  923. max_lisp_eval_depth) and adds an element to the linked list of struct
  924. backtrace's ("backtrace_list").  Each such structure contains a pointer
  925. to the function being called plus a list of the function's arguments.
  926. Originally these values are stored unevalled, and as they are evaluated,
  927. the backtrace structure is updated.  Garbage collection pays attention
  928. to the objects pointed to in the backtrace structures (garbage
  929. collection might happen while a function is being called or while an
  930. argument is being evaluated, and there could easily be no other
  931. references to the arguments in the argument list; once an argument is
  932. evaluated, however, the unevalled version is not needed by eval, and so
  933. the backtrace structure is changed).
  934.  
  935. At this point, the function to be called is determined by looking at the
  936. car of the cons (if this is a symbol, its function definition is
  937. retrieved and the process repeated).  The function should then consist
  938. of either a Lisp_Subr (built-in function), a Lisp_Compiled object, or a
  939. cons whose car is the symbol "autoload", "macro", "lambda", or
  940. "mocklisp".
  941.  
  942. If the function is a Lisp_Subr, the lisp object points to a struct
  943. Lisp_Subr (created by DEFUN()), which contains a pointer to the C
  944. function, a minimum and maximum number of arguments (possibly the
  945. special constants MANY or UNEVALLED), a pointer to the symbol referring
  946. to that subr, and a couple of other things.  If the subr wants its
  947. arguments UNEVALLED, they are passed raw as a list.  Otherwise, an array
  948. of evaluated arguments is created and put into the backtrace structure,
  949. and either passed whole (MANY) or each argument is passed as a C
  950. argument.
  951.  
  952. If the function is a Lisp_Compiled object or a lambda, apply_lambda() is
  953. called.  If the function is a macro, [..... fill in] is done.  If the
  954. function is an autoload, do_autoload() is called to load the definition
  955. and then eval starts over [explain this more].  If the function is a
  956. mocklisp, ml_apply() is called.
  957.  
  958. When eval exits, the evaluation depth is reduced by one, the debugger is
  959. called if appropriate, and the current backtrace structure is removed
  960. from the list.
  961.  
  962. apply_lambda() is passed a function, a list of arguments, and a flag
  963. indicating whether to evaluate the arguments.  It creates an array of
  964. (possibly) evaluated arguments and fixes up the backtrace structure,
  965. just like eval does.  Then it calls funcall_lambda().
  966.  
  967. funcall_lambda() goes through the formal arguments to the function and
  968. binds them to the actual arguments, checking for "&rest" and "&optional"
  969. symbols in the formal arguments and making sure the number of actual
  970. arguments is correct.  Then either progn or byte-code is called to
  971. actually execute the body and return a value.
  972.  
  973. Ffuncall() implements Lisp "funcall".  (funcall fun x1 x2 x3 ...) is
  974. equivalent to (eval (list fun (quote x1) (quote x2) (quote x3) ...)).
  975. Ffuncall() contains its own code to do the evaluation, however, and is
  976. almost identical to eval.
  977.  
  978. Fapply() implements Lisp "apply", which is very similar to funcall
  979. except that if the last argument is a list, the result is the same as if
  980. each of the arguments in the list had been passed separately.  Fapply()
  981. does some business to expand the last argument if it's a list, then
  982. calls Ffuncall() to do the work.
  983.  
  984. apply1(), call0(), call1(), call2(), and call3() call a function,
  985. passing it the argument(s) given (the arguments are given as separate C
  986. arguments rather than being passed as an array).  apply1() uses "apply"
  987. while the others use "funcall".
  988.  
  989. 2. specbindings
  990.  
  991. struct specbinding
  992.   {
  993.     Lisp_Object symbol, old_value;
  994.     Lisp_Object (*func) ();
  995.     Lisp_Object unused;        /* Dividing by 16 is faster than by 12 */
  996.   };
  997.  
  998. struct specbinding is used for local-variable bindings and
  999. unwind-protects.  "specpdl" holds an array of struct specbinding's,
  1000. "specpdl_ptr" points to the beginning of the free bindings in the array,
  1001. "specpdl_size" specifies the total number of binding slots in the array,
  1002. and "max_specpdl_size" specifies the maximum number of bindings the
  1003. array can be expanded to hold.  grow_specpdl() increases the size of the
  1004. specpdl array, multiplying its size by 2 but never exceeding
  1005. max_specpdl_size (except that if this number is less than 400, it is
  1006. first set to 400).
  1007.  
  1008. specbind() binds a symbol to a value and is used for local variables and
  1009. "let" forms.  The symbol and its old value (which might be Qunbound,
  1010. indicating no prior value) are recorded in the specpdl array, and
  1011. specpdl_size is increased by 1.
  1012.  
  1013. record_unwind_protect() implements an unwind-protect, which, when placed
  1014. around a section of code, ensures that some specified cleanup routine
  1015. will be executed even if the code exits abnormally (e.g. through a throw
  1016. or quit).  record_unwind_protect() simply adds a new specbinding to the
  1017. specpdl array and stores the appropriate information in it.  The cleanup
  1018. routine can either be a C function, which is stored in the "func" field,
  1019. or a progn form, which is stored in the "old_value" field.
  1020.  
  1021. unbind_to() removes specbindings from the specpdl array until the
  1022. specified position is reached.  The specbinding can be one of three
  1023. types: (1) an unwind-protect with a C cleanup function ("func" is not 0
  1024. -- old_value holds an argument to be passed to the function); (2) an
  1025. unwind-protect with a Lisp form ("func" is 0 and "symbol" is NIL --
  1026. old_value holds the form to be executed with Fprogn()); or (3) a
  1027. local-variable binding ("func" is 0 and "symbol" is not NIL -- old_value
  1028. holds the old value, which is stored as the symbol's value).
  1029.  
  1030. 3. special forms
  1031.  
  1032. 3a. or, and, if, cond, progn, prog1, prog2, setq, quote, function, let*,
  1033. let, while
  1034.  
  1035. All of these are very simple and work as expected, calling Feval() or
  1036. Fprogn() as necessary and (in the case of let and let*) using specbind()
  1037. to create bindings and unbind_to() to undo the bindings when finished.
  1038. Note that these functions do a lot of GCPRO()ing to protect their
  1039. arguments from garbage collection because they call Feval() (see
  1040. "garbage collection").
  1041.  
  1042. 3b. catch, throw
  1043.  
  1044. struct catchtag
  1045.   {
  1046.     Lisp_Object tag;
  1047.     Lisp_Object val;
  1048.     struct catchtag *next;
  1049.     struct gcpro *gcpro;
  1050.     jmp_buf jmp;
  1051.     struct backtrace *backlist;
  1052.     int lisp_eval_depth;
  1053.     int pdlcount;
  1054.   };
  1055.  
  1056. "catch" is a Lisp function that places a catch around a body of code.  A
  1057. catch is a means of non-local exit from the code.  When a catch is
  1058. created, a tag is specified, and executing a "throw" to this tag will
  1059. exit from the body of code caught with this tag, and its value will be
  1060. the value given in the call to "throw".  If there is no such call, the
  1061. code will be executed normally.
  1062.  
  1063. Information pertaining to a catch is held in a struct catchtag, which is
  1064. placed at the head of a linked list pointed to by "catchlist".
  1065. internal_catch() is passed a C function to call (Fprogn() when Lisp
  1066. "catch" is called) and arguments to give it, and places a catch around
  1067. the function.  Each struct catchtag is held in the stack frame of the
  1068. internal_catch() instance that created the catch.
  1069.  
  1070. internal_catch() is fairly straightforward.  It stores into the struct
  1071. catchtag the tag name and the current values of backtrace_list,
  1072. lisp_eval_depth, gcprolist, and the offset into the specpdl array, sets
  1073. a jump point with _setjmp() (storing the jump point into the struct
  1074. catchtag), and calls the function.  Control will return to
  1075. internal_catch() either when the function exits normally or through a
  1076. _longjmp() to this jump point.  In the latter case, "throw" will store
  1077. the value to be returned into the struct catchtag before jumping.  When
  1078. it's done, internal_catch() removes the struct catchtag from the
  1079. catchlist and returns the proper value.
  1080.  
  1081. Fthrow() goes up through the catchlist until it finds one with a
  1082. matching tag.  It then calls unbind_catch() to restore everything to
  1083. what it was when the appropriate catch was set, stores the return value
  1084. in the struct catchtag, and jumps (with _longjmp()) to its jump point.
  1085.  
  1086. unbind_catch() removes all catches from the catchlist until it finds the
  1087. correct one.  Some of the catches might have been placed for
  1088. error-trapping, and if so, the appropriate entries on the handlerlist
  1089. must be removed (see "errors").  unbind_catch() also restores the values
  1090. of gcprolist, backtrace_list, and lisp_eval, and calls unbind_to() to
  1091. undo any specbindings created since the catch.
  1092.  
  1093. 3c. other [fill in]
  1094.  
  1095.  
  1096.  
  1097. ----------------------------------------------------------------------
  1098. -------------------------------- events ------------------------------
  1099. ----------------------------------------------------------------------
  1100.  
  1101. typedef enum emacs_event_type {
  1102.   empty_event,
  1103.   key_press_event,
  1104.   button_press_event,
  1105.   button_release_event,
  1106.   pointer_motion_event,
  1107.   process_event,
  1108.   timeout_event,
  1109.   magic_event,
  1110.   eval_event,
  1111.   menu_event,
  1112.   dead_event
  1113. } emacs_event_type;
  1114.  
  1115. #define first_event_type empty_event
  1116. #define last_event_type dead_event
  1117.  
  1118. struct key_data {
  1119.   int               key;
  1120.   unsigned char     modifiers;
  1121. };
  1122.  
  1123. struct button_data {
  1124.   int               button;
  1125.   unsigned char     modifiers;
  1126.   int               x, y;
  1127. };
  1128.  
  1129. struct motion_data {
  1130.   int               x, y;
  1131. };
  1132.  
  1133. struct process_data {
  1134.   Lisp_Object       process;
  1135. };
  1136.  
  1137. struct timeout_data {
  1138.   Lisp_Object       function;
  1139.   Lisp_Object        object;
  1140.   int            id_number;
  1141. };
  1142.  
  1143. struct eval_data {
  1144.   Lisp_Object       function;
  1145.   Lisp_Object        object;
  1146. };
  1147.  
  1148. #ifndef MAX_UNDERLYING_EVENT_SIZE
  1149. # ifdef HAVE_X_WINDOWS
  1150. #  define MAX_UNDERLYING_EVENT_SIZE (sizeof (XEvent))
  1151. # else
  1152. #  define MAX_UNDERLYING_EVENT_SIZE 1
  1153. # endif
  1154. #endif
  1155.  
  1156. struct magic_data {
  1157.   char           underlying_event [MAX_UNDERLYING_EVENT_SIZE];
  1158. };
  1159.  
  1160. struct Lisp_Event {
  1161.   emacs_event_type    event_type;
  1162.   Lisp_Object        channel;
  1163.   unsigned int        timestamp;
  1164.   union {
  1165.     struct key_data    key;
  1166.     struct button_data    button;
  1167.     struct motion_data    motion;
  1168.     struct process_data    process;
  1169.     struct timeout_data    timeout;
  1170.     struct eval_data    eval;   /* menu_event uses this too */
  1171.     struct magic_data    magic;
  1172.   } event;
  1173.   struct Lisp_Event    *next;    /* - For dead events, this is the next dead
  1174.                      one.
  1175.                    - For events on the command_event_queue,
  1176.                      this is the next one on the queue.
  1177.                    - Otherwise it's 0.
  1178.                  */
  1179. };
  1180.  
  1181. struct event_stream {
  1182.   int  (*event_pending_p)    (int);
  1183.   void (*next_event_cb)        (struct Lisp_Event *);
  1184.   void (*handle_magic_event_cb)    (struct Lisp_Event *);
  1185.   int  (*generate_wakeup_cb)    (unsigned int, unsigned int,
  1186.                  Lisp_Object, Lisp_Object);
  1187.   void (*disable_wakeup_cb)    (int);
  1188.   void (*select_tty_cb)        (int);
  1189.   void (*unselect_tty_cb)    (int);
  1190.   void (*select_process_cb)    (struct Lisp_Process *);
  1191.   void (*unselect_process_cb)    (struct Lisp_Process *);
  1192. #ifdef SIGIO
  1193.   void (*sigio_cb)        ();
  1194. #endif
  1195. };
  1196.  
  1197. The event code is designed to be essentially system-independent.  struct
  1198. event_stream holds functions that interface between the generic event
  1199. routines in Emacs and the specific window system, such as X.  There is
  1200. one instance, called "event_stream", of this structure.  The event
  1201. itself is held in struct Lisp_Event, which is filled in by the
  1202. system-specific next_event_cb.
  1203.  
  1204. 1. managing struct Lisp_Event's [event-alloc.c]
  1205.  
  1206. allocate-event, deallocate-event, and copy-event are in event-alloc.c;
  1207. see its description.  This module also contains some routines used
  1208. during garbage-collection.
  1209.  
  1210. 2. converting event types [events.c]
  1211.  
  1212. character_to_event(), event_to_character(), event-to-character, and
  1213. character-to-event convert between ASCII characters and keypresses
  1214. corresponding to the characters.  If the event was not a keypress,
  1215. event_to_character() returns -1 and event-to-character returns NIL.  These
  1216. functions convert between ASCII representation and the split-up event
  1217. representation (keysym plus mod keys).
  1218.  
  1219. format_event_object() takes an event of any type and returns a short string
  1220. describing to this event. (e.g. M-C-x for a keypress of meta-control-X).
  1221.  
  1222. 3. event predicates
  1223.  
  1224. eventp, key-press-event-p, button-press-event-p, button-release-event-p,
  1225. button-event-p, motion-event-p, process-event-p, timeout-event-p,
  1226. menu-event-p, and eval-event-p are fairly self-explanatory.
  1227.  
  1228. 4. event properties
  1229.  
  1230. event-timestamp, event-key, event-button, event-modifier-bits,
  1231. event-modifiers, event-x-pixel, event-y-pixel, event-window, event-point,
  1232. event-x, event-y, event-glyph, event-process, event-function, and
  1233. event-object are fairly clear.  Some of these routines call
  1234. event_pixel_translation(), which takes a motion or button event and returns
  1235. the window, x and y character position, buffer, and glyph over which the
  1236. event occurred [what is a glyph?].  The work is actually done by
  1237. pixel_to_glyph_translation (see "display").
  1238.  
  1239. event_equal(), used by equal, compares two events.
  1240.  
  1241.  
  1242. 5. obtaining events
  1243.  
  1244. NOTE: I am not sure whether the routines below ever get executed
  1245. asynchronously.  If so, life gets messy.
  1246.  
  1247. next-event fills in a struct Lisp_Event with an event.  The event comes
  1248. from one of three places:
  1249.  
  1250. 1) unread-command-event, if not NIL (copied with copy-event)
  1251. 2) a keyboard macro, if we're in one (pop_kbd_macro_event())
  1252. 3) next_event_internal()
  1253.  
  1254. Before getting an event, next-event refreshes the screen (redisplay())
  1255. if there is no event pending (detect_input_pending()).  After getting an
  1256. event, next-event does various processing:
  1257.  
  1258. 1) maybe_status_notify() is called.
  1259.  
  1260. 2) for key-presses, maybe_do_auto_save() is called.
  1261.  
  1262. 3) for key-presses and button events, things are set up so that the
  1263. event will be echoed in the echo area after a fixed amount of time.
  1264.  
  1265. 4) for "command events" (key-presses, button actions, and menu
  1266. selections), [V]last-input-event, [V]last-input-char,
  1267. [V]last-input-time, [V]this-command-keys (visible as Lisp function
  1268. this-command-keys), and recent_keys_ring (visible as Lisp function
  1269. recent-keys-ring) are updated/  If we're defining a keyboard macro, the
  1270. macros is updated.
  1271.  
  1272. 5) if the help key was pressed (variable "help_char"),
  1273. execute_help_form() is called.
  1274.    
  1275. next_event_internal() obtains an event either from the
  1276. command_event_queue or, if this is empty, by calling next_event_cb.
  1277. (The queue is linked through the "next" field of struct Lisp_Event;
  1278. events are placed on the queue by enqueue_command_event(), which is
  1279. called by some functions that read events, filter some of them out, and
  1280. put the remaining ones back.)  next_event_internal() also checks if the
  1281. event was a keypress of interrupt_char (defined to be ^G in keyboard.c),
  1282. and calls interrupt_signal() if so.
  1283.  
  1284. detect_input_pending() and input-pending-p look for input by calling
  1285. event_stream->event_pending_p and looking in [V]unread-command-event and
  1286. the command_event_queue (they do not check for an executing keyboard
  1287. macro, though).
  1288.  
  1289. discard-input cancels any command events pending (and any keyboard
  1290. macros currently executing), and puts the others onto the
  1291. command_event_queue.  There is a comment about a "race condition",
  1292. which is not a good sign.
  1293.  
  1294. next-command-event and read-char are higher-level interfaces to
  1295. next-event.  next-command-event gets the next "command" event (i.e.
  1296. keypress, mouse event, or menu selection), calling dispatch-event on
  1297. any others.  read-char calls next-command-event and uses
  1298. event_to_character() to return the ASCII equivalent.
  1299.  
  1300. accept-process-output???
  1301.  
  1302. 6, 7, ... [more event stuff]
  1303.  
  1304. ----------------------------------------------------------------------
  1305. ---------------------- execution of Lisp code ------------------------
  1306. ----------------------------------------------------------------------
  1307.  
  1308. Main data structures during Lisp execution:
  1309.  
  1310. 1. staticvec[]: lists all global and static C variables that hold Lisp
  1311. objects.  Used during garbage collection.  See "allocation".
  1312.  
  1313.  
  1314.  
  1315. gcprolist, specpdl, and backtrace_list are stacks that are added to and
  1316. removed from as Lisp and C functions are entered and exited.
  1317.  
  1318. 2. gcprolist: points to a linked list of struct gcpro's, listing
  1319. currently-active C local variables that hold Lisp objects.  Each struct
  1320. gcpro is located in the same stack frame as the local variable it
  1321. references.  Used during garbage collection.  See "allocation".
  1322.  
  1323. 3. specpdl: points to an array of struct specbinding's, each of which
  1324. references a currently-active Lisp local binding or a currently-active
  1325. unwind-protect.  See "eval".
  1326.  
  1327. 4. backtrace_list: points to a linked list of struct backtrace's, each
  1328. of which gives information about a Lisp function call currently
  1329. executing.  Each struct backtrace is located in the stack frame of the
  1330. Feval() or Ffuncall() instance that initiated the function call.  See
  1331. "eval".
  1332.  
  1333.  
  1334.  
  1335. 5. Vobarray: holds the obarray, which lists all symbols that have been
  1336. interned.  The obarray is a vector of linked lists arranged as a
  1337. separately-chained hash table.  See "obarray".
  1338.  
  1339. 6. catchlist: points to a linked list of struct catchtag's, each of
  1340. which specifies a catch that is currently active.  Each struct catchtag
  1341. is located in the stack frame of the instance of internal_catch(),
  1342. Fcondition_case(), or internal_condition_case() that created the catch.
  1343. See "eval -- special forms".
  1344.  
  1345. 7. handlerlist: points to a linked list of struct handler's, each of
  1346. which corresponds to a condition-case that is currently active.  Each
  1347. struct handler is located in the stack frame of the instance of
  1348. Fcondition_case() or internal_condition_case() that created the
  1349. condition-case.  See "errors".
  1350.  
  1351.  
  1352. ----------------------------------------------------------------------
  1353. ------------------------------ Extents -------------------------------
  1354. ----------------------------------------------------------------------
  1355.  
  1356. [extents.c]
  1357. [extents.h]
  1358.  
  1359. An "extent" is a region of text with a certain property, such as
  1360. invisible, read-only, or highlighted.  Extents can overlap, and the
  1361. text under overlapping extents has all the properties of the extents
  1362. lying over that text. [what if some properties contradict each other?]
  1363.  
  1364. 1. structures
  1365.  
  1366. typedef struct 
  1367. {
  1368.   int seal;                     /* must be EXTENT_SEAL */
  1369.   Id id;
  1370.   int extentType;               /* oneof CEAttribute, CEAbbreviation, etc. */
  1371.   Lisp_Object extent;           /* corresponding extent */
  1372. #ifdef ENERGIZE
  1373.   Lisp_Object start_glyph_index;
  1374.   Lisp_Object end_glyph_index;
  1375. #endif
  1376.   union
  1377.     {
  1378.       struct
  1379.         {                       /* CEAttribute */
  1380.           int attrValue;
  1381.         } attr;
  1382.       struct 
  1383.         {                       /* CEAbbreviation */
  1384.           Boolean isOpened;
  1385.         } abbrev;
  1386.       struct 
  1387.         {                       /* CEGeneric */
  1388.           GenericData* gData;
  1389.         } generic;
  1390.     } u;
  1391. } Extent_Data;
  1392.  
  1393. 1a. struct extent
  1394.  
  1395. struct extent
  1396. {
  1397.   unsigned short flags;
  1398.   /* non-zero only for "extended type extents" */
  1399.   unsigned short secondary_type;
  1400.   int start;
  1401.   int end;
  1402.   struct extent *next;
  1403.   struct extent *previous;
  1404.   struct extent *e_next;
  1405.   struct extent *e_previous;
  1406.   int attr_index;
  1407.   Lisp_Object buffer;
  1408.   Lisp_Object user_data;
  1409. };
  1410.  
  1411. "start", "end" are the limits of the extent.  "buffer" is the buffer this
  1412. extent refers to.  "flags" is the properties of the extent, defined in
  1413. extents.h.  "next", "previous", "e_next", and "e_previous" are used to
  1414. link all the extents together.  Extents are linked in two bidirectional
  1415. linked lists -- one ordered by start position ("next", "previous") and
  1416. the other by end position ("e_next", "e_previous").  "user_data" is any
  1417. extra data that the user might choose to associate with an extent.
  1418.  
  1419. attr_index?  secondary_type?
  1420.  
  1421. typedef struct extent *EXTENT;
  1422.  
  1423. 1b. extent indices
  1424.  
  1425. The start and end positions of an extent are simple character indices.  This
  1426. is not necessarily the same as the buffer index, because the latter takes
  1427. the gap into account. (see "buffer")
  1428.  
  1429. buffer_pos_to_extent_index(pos, buf)
  1430. extent_index_to_buffer_pos(index, pos)
  1431.     These functions perform the conversion between buffer indices and
  1432.     extent indices.
  1433.  
  1434. 1c. extent lists
  1435.  
  1436. Extents are linked in two bi-directional linked lists.  The orderings for
  1437. these two lists are called "display" or "normal" order and "e-order", which
  1438. are essentially sorting by start and end positions, respectively.
  1439.  
  1440. splice_extent_into_buffer(extent, buffer)
  1441.     Inserts an extent into the linked lists.
  1442. detach_extent()
  1443.     Removes an extent from the linked lists and sets its start and end
  1444.     positions to 0.
  1445. next-extent
  1446. next-e-extent
  1447.     Returns the next extent in the specified list.
  1448.  
  1449. 1. creating an extent
  1450.  
  1451. Extents are managed just like cons cells -- see "allocation".
  1452.  
  1453. make_extent(void) [alloc.c]
  1454.     Allocates and returns a new extent.
  1455. make-extent
  1456.     Creates a new extent; calls make_extent_internal().
  1457. make_extent_internal(from, to, buffer, extent_data)
  1458.     Allocates an extent, sets the position of the extent, and inserts it
  1459.     into the buffer's extent lists.
  1460. delete-extent
  1461.     Destroys an extent; calls destroy_extent() and sets some flags
  1462.     indicating that the buffer's display has changed.
  1463. destroy_extent()
  1464.     Removes an extent from the buffer's extent lists and clears its values.
  1465.     It will be reclaimed during garbage collection.
  1466.  
  1467. 3. extent properties
  1468.  
  1469. EF_*
  1470.     Masks referring to particular properties in the extent's "flags" field.
  1471. SET_EXTENT_FLAG()
  1472. CLEAR_EXTENT_FLAG()
  1473. EXTENT_FLAG_P()
  1474.     Macros that get or set particular properties in the "flags" field.
  1475.  
  1476. extent-start-position
  1477. extent-end-position
  1478. extent-length
  1479. extent-buffer
  1480.     Return the respective properties of an extent.
  1481. update-extent
  1482.     Change the start and end positions of an extent.  This detaches the
  1483.     extent, sets the positions, and inserts the extent back into the buffer's
  1484.     extent lists.
  1485. update_extent()
  1486.     Does the same thing as update-extent, but has separate code.
  1487.  
  1488. extent-attributes
  1489. set-extent-attribute
  1490.     Get or set the attributes (invisible, highlighted, etc.) of an extent.
  1491.  
  1492. extent-data
  1493. set-extent-data
  1494.     get or set the user data for an extent.
  1495.  
  1496. 4. mapping over extent lists
  1497.  
  1498. typedef int (*emf)(EXTENT extent, void *arg);
  1499. typedef int (*elisp_emf)(Lisp_Object extent_obj, void *arg);
  1500.  
  1501. struct slow_map_extents_arg
  1502. {
  1503.   Lisp_Object map_arg;
  1504.   Lisp_Object map_routine;
  1505. };
  1506.  
  1507.  
  1508. map-extents
  1509.     Calls a function on all extents overlapping a specified range.
  1510.     map_extents() is called and given as its function either the
  1511.     specified function (if it's a built-in subr) or
  1512.     slow_map_extents_function (if the specified function is a user
  1513.     function).
  1514. map_extents()
  1515.     Calls a function on all extents overlapping a specified range.
  1516.     It marches down the display-order list of extents and checks
  1517.     each one to see if the range matches.  The function is called
  1518.     with two arguments -- the extent itself and a user-supplied
  1519.     value.
  1520. slow_map_extents_function()
  1521.     Function given to map_extents() so that user-defined Lisp functions
  1522.     can be mapped.  The second argument given to it is a struct
  1523.     slow_map_extents_arg, containing the Lisp function and the actual
  1524.     argument to be given to it.  call2() is used to call the function.
  1525.  
  1526. 5. determine the smallest enclosing extent for a position
  1527.  
  1528. struct extent_at_struct
  1529. {
  1530.   EXTENT best_match;
  1531.   int flag;
  1532. };
  1533.  
  1534. extent-at
  1535.     Determines the smallest extent overlapping a specified position and
  1536.     having the specified properties.  Calls extent_at().
  1537. extent_at()
  1538.     Does the actual work.  Maps the function extent_at_mf() over all
  1539.     extents.  The argument given is of type struct extent_at_struct.
  1540. extent_at_mf()
  1541.     The map function used by extent_at().  Checks the extent to see if
  1542.     it's a candidate and is smaller than the smallest one found so far.
  1543.  
  1544. 6. highlighting an extnt
  1545.  
  1546. The display code looks in [V]last-highlighted-extent to determine which
  1547. extent should be highlighted.
  1548.  
  1549. extent_highlightable_p()
  1550.     True if an extent has the "highlightable" property.
  1551. do_highlight()
  1552.     Highlight or unhighlight an extent.  This involves changing
  1553.     [V]last-highlighted-extent and setting some flags indicating that
  1554.     the buffer has changed.
  1555. highlight-extent
  1556.     Highlight an extent if it has the "highlightable" property.  Calls
  1557.     do_highlight().
  1558. force-highlight-extent
  1559.     Highlight an extent always.  Calls do_highlight().
  1560.  
  1561. 7. Dealing with textual change
  1562.  
  1563. The range of an extent is adjusted when text is inserted or deleted.
  1564. In addition, some extents must be deleted entirely.
  1565.  
  1566. [extents.c]
  1567.  
  1568. /* not used at the moment */   
  1569. struct process_extents_for_insertion_struct
  1570. {
  1571.   int opoint;
  1572.   int length;
  1573.   struct buffer *buf;
  1574. };
  1575.    
  1576. struct process_extents_for_deletion_struct
  1577. {
  1578.   int start;
  1579.   int end;
  1580.   int destroy_included_extents;
  1581. };
  1582.  
  1583. adjust_extent_index()
  1584. adjust_extents()
  1585.  
  1586. process_extents_for_insertion()
  1587. process_extents_for_deletion_mf()
  1588. process_extents_for_deletion()
  1589. process_extents_for_destruction()
  1590.  
  1591.  
  1592. 8. checking the read-only property of a range of extent
  1593.  
  1594. verify_extent_modification() is called by prepare_to_modify_buffer() in
  1595. insdel.c, and makes sure that none of the region about to be modified is
  1596. read-only.
  1597.  
  1598. struct end_points
  1599. {
  1600.   int start;
  1601.   int end;
  1602. };
  1603.  
  1604. verify_extent_modification(buffer, from, to)
  1605.     Make sure none of the text in the specified range is read-only.
  1606.     Maps verify_extent_mf() over all extents.  The argument given to this
  1607.     function is of type struct end_points.
  1608. verify_extent_mf()
  1609.     Called by map_extents().  Signals an error if the specified extent is
  1610.     read-only and overlaps the specified range of text.
  1611.  
  1612. 9. extent fragments
  1613.  
  1614. An "extent fragment" is a structure holding all of the extents overlapping
  1615. a particular position, as well as the range of positions around
  1616. the specified position which have exactly the same extents overlapping
  1617. them (i.e. the maximum range containing this position in which no extents
  1618. begin or end).  All characters in this range have exactly the same
  1619. properties.
  1620.  
  1621. [extents.h]
  1622.  
  1623. struct extent_fragment
  1624. {
  1625.   /* buffer and modification event of buffer for this fragment */
  1626.   struct buffer *buf;
  1627.   int modiff;
  1628.   int face_change;
  1629.   /* covers buffer positions [from, to-1] */
  1630.   int from;
  1631.   int to;
  1632.   /* these are the buffer array indices of positions from and to */
  1633.   int start_index;
  1634.   int end_index;
  1635.   /* first extent past the stack */
  1636.   EXTENT first_extent_past_stack;
  1637.   int number_of_extents;
  1638.   EXTENT *extents_stack;
  1639.   int extents_stack_length;
  1640.   struct face *fp;
  1641. };
  1642.  
  1643. typedef struct extent_fragment *EXTENT_FRAGMENT;
  1644.  
  1645. struct extent_fragment extent_fragment;
  1646. int extent_cache_invalid;
  1647.  
  1648. "buf" is the buffer this extent fragment refers to, and "modiff" and
  1649. "face_change" hold the values of these buffer fields when the extent
  1650. fragment was created.  "from" and "to" are the range in buffer indices,
  1651. and "start_index" and "end_index" the corresponding range in extent
  1652. indices (i.e. the former range takes into account the gap).  "extents_stack"
  1653. is the array of extents overlapping the range, and "number_of_extents"
  1654. the number of extents in this array.  "extents_stack_length" is the
  1655. actual size of the array, which is >= number_of_extents (the array is
  1656. realloc()ed as necessary to accommodate more extents).
  1657. "first_extent_past_stack" is the first extent whose start position is past
  1658. the end of the range.
  1659.  
  1660. The global variable "extent_fragment" is of type struct extent_fragment
  1661. and is used by the extent fragment routines.
  1662.  
  1663. init_extent_fragment(void)
  1664.     Initializes the variable "extent_fragment".
  1665. buffer_extent_fragment_at(pos, buffer, screen)
  1666.     Determines the extent fragment surrounding the specified position.  It
  1667.     first checks if the previously-calculated extent fragment is still
  1668.     valid (by looking at "extent_cache_invalid" and the values of MODIFF
  1669.     and FACE_CHANGE stored in the variable "extent_fragment", among
  1670.     other things), and only    does the recalculation (by calling
  1671.     befa_internal()) if not.  A pointer to "extent_fragment" is returned.
  1672. internal_befa(pos, buffer)
  1673.     Actually calculates the extent fragment.  Returns a pointer to
  1674.     "extent_fragment".
  1675.  
  1676. 10. stack of extents
  1677.  
  1678. Every buffer has a "stack of extents", which is used to speed up traversing
  1679. through the extents, looking for extents that overlap a particular range.
  1680. The stack of extents is used by buffer_starting_extent(), which returns an
  1681. extent that you can start such a traversal at.  The stack of extents is
  1682. stored in a buffer's "cached_stack" field and is held in a "struct
  1683. stack_of_extents".  This structure contains a buffer position, an array of
  1684. all the extents that overlap the position, and the "previous" extent,
  1685. which is the last extent (in display order) that does not overlap the
  1686. position and which comes before (in display order) all the extents that
  1687. do.
  1688.  
  1689. The code to manipulate a stack of extents is hairy and involved, and there
  1690. are lots of comments in extents.c.
  1691.  
  1692. /* sort of a mini-version of the extents fragment -- each buffer
  1693.    with an extents list gets one of these */
  1694. struct stack_of_extents
  1695. {
  1696.   /* an extent "before" those on the stack, or 0 if none is known */
  1697.   EXTENT previous_extent;
  1698.   /* buf_index over which this stack lies */
  1699.   int buf_index;
  1700.   EXTENT *stack;
  1701.   int stack_length;
  1702.   int stack_index;
  1703. };
  1704.  
  1705. soe_to_lisp()
  1706. stack-of-extents
  1707. verify_buffer_stack()
  1708. soe_push()
  1709. soe_duplicate()
  1710. soe_delq()
  1711. init_buffer_cached_stack()
  1712. soe_clear()
  1713. soe_prune()
  1714. free_buffer_cached_stack()
  1715. cleanup_old_stack()
  1716. update_cache_forward()
  1717.  
  1718. 11. extent replicas
  1719.  
  1720. [I think] Extent replicas are used when text is cut or copied from a buffer.
  1721. the extents that overlap the text are copied into extent replicas that are
  1722. attached to the text.
  1723.  
  1724. [extents.h]
  1725.  
  1726. struct extent_replica
  1727. {
  1728.   int start;
  1729.   int end;
  1730.   Lisp_Object extent;
  1731. };
  1732.  
  1733. typedef struct extent_replica *EXTENT_REPLICA;
  1734. typedef struct extent_replica *DUP;
  1735.  
  1736. struct merge_replicas_struct
  1737. {
  1738.   Lisp_Object dup_list;
  1739.   int entry_offset;
  1740.   int entry_length;
  1741. };
  1742.  
  1743. [extents.c]
  1744.  
  1745. struct replicate_extents_struct
  1746. {
  1747.   int from;
  1748.   int length;
  1749.   struct buffer *buf;
  1750.   Lisp_Object head;
  1751.   Lisp_Object nconc_cell;
  1752. };
  1753.  
  1754. replicate_extents_mf()
  1755. replicate_extents()
  1756. splice_in_extent_replicas()
  1757. merge_replicas()
  1758. add_to_replicas_lists()
  1759. merge_replicas_concatenating_mf()
  1760. mrp_pred()
  1761. merge_replicas_pruning_mf()
  1762.  
  1763. x. miscellaneous
  1764.  
  1765. check_from_to(from, to, buf)
  1766.     Make sure that positions "from" and "to" lie within the buffer "buf".
  1767. extent_endpoint(extent, endp)
  1768.     Returns the start or end point of the specified extent, as a *buffer*
  1769.     index.
  1770. extent_index_offset()
  1771. buffer_starting_extent()
  1772. syms_of_extents()
  1773.  
  1774. y. not yet dealt with
  1775.  
  1776. set_extent_flags()
  1777. set_extent_attributes_index()
  1778. install_extent_glyphs()
  1779. restore_extent_state()
  1780.  
  1781. extent_to_generic_id()
  1782. make_extent_for_data()
  1783. extent_glyph_at()
  1784. extent-to-generic-id
  1785. glyph_in_column_p()
  1786. restore-extent
  1787.  
  1788. set_point_internal()
  1789. set_point()
  1790. set_buffer_point()
  1791. last_visible_position()
  1792.  
  1793. ----------------------------------------------------------------------
  1794. ------------------------------- Faces --------------------------------
  1795. ----------------------------------------------------------------------
  1796.  
  1797. struct face
  1798. {
  1799.   unsigned char underline;
  1800.   unsigned char hilited;
  1801.   unsigned char modif;
  1802. #ifdef HAVE_X_WINDOWS
  1803.   GC         facegc;
  1804.   XFontStruct*    font;
  1805. #if 0
  1806.   char*     font_name;    /* missing piece of info from XFontStruct... */
  1807. #endif                /* we store this up in lisp now */
  1808.   unsigned long    foreground;
  1809.   unsigned long    background;
  1810.   Pixmap    back_pixmap;
  1811.   unsigned int    pixmap_w, pixmap_h, pixmap_depth;
  1812. #endif /* HAVE_X_WINDOWS */
  1813. };
  1814.  
  1815. About faces:
  1816.  
  1817. A face is represented on the Lisp level as an array of 8 elements, the first
  1818. of which is the symbol 'face:
  1819.  
  1820. element:    meaning:
  1821. 0        'face
  1822. 1        name of face
  1823. 2        face id number
  1824. 3        name of face's font or nil
  1825. 4        name of foreground color
  1826. 5        name of background color
  1827. 6        name of background pixmap
  1828. 7        whether face is underlined
  1829.  
  1830. In the C code, faces are stored as a struct face:
  1831.  
  1832. struct face
  1833. {
  1834.   unsigned char underline;
  1835.   unsigned char hilited;
  1836.   unsigned char modif;
  1837.   unsigned char fill_style;
  1838.   struct font *font;
  1839.   unsigned long    foreground;
  1840.   unsigned long    background;
  1841.   struct x_bitmap *back_pixmap;
  1842. };
  1843.  
  1844. Every screen contains an alist of all the faces, associating the face's name
  1845. with its representation as a Lisp vector.  In addition, each screen contains
  1846. an array of pointers to struct face's, one per face, indexed by the face's
  1847. id number.  Note that the Lisp data shadows the C data and that each screen
  1848. contains a separate copy of all the faces; this is so that faces of the same
  1849. name (e.g. "default" or "modeline") can display differently for different
  1850. screens.
  1851.  
  1852. In struct screen, "face_alist" is the screen's alist of faces, "faces" is the
  1853. array of pointers to struct face's, and "n_faces" is the number of elements
  1854. in the array.
  1855.  
  1856. make-face creates a new face with a specified name, setting its name and id
  1857. number and leaving its other attributes unspecified.  It modifies the
  1858. face-alist of all the screens and calls make-face-internal to create the
  1859. struct face's and modify the C pointers.
  1860.  
  1861. Individual characteristics of a face are modified with set-face-font,
  1862. set-face-foreground, set-face-background, set-face-background-pixmap,
  1863. and set-face-underline.  All of these allow modifying the characteristic
  1864. of the face only on one screen or on all screens.  All call set-face-1, which
  1865. modifies the Lisp faces appropriately and calls set-face-attribute-internal
  1866. to change the C structures.  This function calls load_pixmap(), load_font(),
  1867. load_color(), etc. as necessary.
  1868.  
  1869. Individual characteristics of a face are retrieved with face-name, face-id,
  1870. face-font, face-foreground, face-background, face-background-pixmap, and
  1871. face-underline-p.
  1872.  
  1873.  
  1874. ----------------------------------------------------------------------
  1875. ------------------------------ Fonts ---------------------------------
  1876. ----------------------------------------------------------------------
  1877.  
  1878. The font type is XFontStruct.
  1879.  
  1880. #define FONT_WIDTH(f)    ((f)->max_bounds.width)
  1881. #define FONT_HEIGHT(f)    ((f)->ascent + (f)->descent)
  1882. #define TOTAL_HEIGHT(f)    ((f)->ascent + (f)->descent + x_interline_space)
  1883. #define FONT_BASE(f)    ((f)->ascent)
  1884.  
  1885. FONT_ASCENT(f) [xdisp.c] is equivalent to FONT_BASE(f).
  1886. x_interline_space is the space in pixels to be placed between lines.
  1887.  
  1888. The baseline is the line on which all characters are to be placed.  Some
  1889. characters extend below the baseline as well as above it (e.g. lowercase g).
  1890. The "ascent" is the number of pixels the character extends above the
  1891. baseline, and the "descent" the number of pixels the character extends below
  1892. the baseline.  These two values vary from character to character.
  1893.  
  1894. The default font for a screen is contained in screen->display.x->font.
  1895.  
  1896. ----------------------------------------------------------------------
  1897. -------------------------- Fundamental Types -------------------------
  1898. ----------------------------------------------------------------------
  1899.  
  1900. Lisp_Object is the main type.  This is just a 32-bit int, of which the lowest
  1901. 24 (or 26) bits are the value of the type (either an integer or a pointer
  1902. to the type's actual value), the remaining bits except 1 specify the type,
  1903. and the highest bit is a garbage-collection bit that is always 0 when not
  1904. in garbage-collection.  Accessing the value of a Lisp_Object as a particular
  1905. type is done through the macros in lisp.h, which are all in capital letters
  1906. without any underscores, and begin with X (e.g. XINT(), XSYMBOL(), etc.).
  1907. These macros mask off the type bits and cast the value to the correct integer
  1908. or pointer type.
  1909.  
  1910. The types (enum Lisp_Type) are:
  1911.  
  1912. Lisp_Int
  1913.     Integer.  XINT(obj) is the integer value. 
  1914.  
  1915. Lisp_Symbol
  1916.     Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol. 
  1917.  
  1918. Lisp_Marker
  1919.     Marker (buffer ptr).  XMARKER(object) points to a struct Lisp_Marker. 
  1920.  
  1921. Lisp_String
  1922.     String.  XSTRING (object) points to a struct Lisp_String.
  1923.     The length of the string, and its contents, are stored therein. 
  1924.  
  1925. Lisp_Vector
  1926.     Vector of Lisp objects.  XVECTOR(object) points to a struct
  1927.     Lisp_Vector.  The length of the vector, and its contents, are
  1928.     stored therein. 
  1929.  
  1930. Lisp_Cons
  1931.     Cons.  XCONS (object) points to a struct Lisp_Cons. 
  1932.  
  1933. Lisp_Compiled
  1934.     Byte-compiled function.  A vector of 4 to 6 elements which are the
  1935.         arglist, bytecode-string, constant vector, stack size,
  1936.         (optional) doc string, and (optional) interactive spec.  
  1937.  
  1938. Lisp_Buffer
  1939.     Editor buffer.  XBUFFER(obj) points to a struct buffer.  
  1940.  
  1941. Lisp_Subr
  1942.     Built-in function.  XSUBR(obj) points to a struct Lisp_Subr
  1943.         which describes how to call the function, and its documentation,
  1944.         as well as pointing to the code. 
  1945.  
  1946. Lisp_Internal
  1947.     Internal value return by subroutines of read.
  1948.     The user never sees this data type.
  1949.         Its value is just a number. 
  1950.  
  1951. Lisp_Intfwd
  1952.     Forwarding pointer to an int variable.
  1953.         This is allowed only in the value cell of a symbol,
  1954.         and it means that the symbol's value really lives in the
  1955.         specified int variable.
  1956.         XINTPTR(obj) points to the int variable. 
  1957.  
  1958. Lisp_Boolfwd
  1959.     Boolean forwarding pointer to an int variable.
  1960.         This is like Lisp_Intfwd except that the ostensible
  1961.         "value" of the symbol is t if the int variable is nonzero,
  1962.         nil if it is zero.  XINTPTR(obj) points to the int variable. 
  1963.  
  1964. Lisp_Process
  1965.     Object describing a connection to a subprocess.
  1966.         It points to storage of type struct Lisp_Process.
  1967.  
  1968. Lisp_Objfwd
  1969.     Forwarding pointer to a Lisp_Object variable.
  1970.         This is allowed only in the value cell of a symbol,
  1971.         and it means that the symbol's value really lives in the
  1972.         specified variable.
  1973.         XOBJFWD(obj) points to the Lisp_Object variable. 
  1974.  
  1975. Lisp_Screen
  1976.     Pointer to a vector-like object describing a display screen
  1977.         on which Emacs can display a window hierarchy.  
  1978.  
  1979. Lisp_Internal_Stream
  1980.     Used when a FILE * value needs to be passed
  1981.         in an argument of type Lisp_Object.
  1982.         You must do *(FILE **) XPNTR(obj) to get the value.
  1983.         The user will never see this data type. 
  1984.  
  1985. Lisp_Buffer_Local_Value
  1986.     Used in a symbol value cell when the symbol's value is per-buffer.
  1987.         The actual contents are a cons cell which starts a list like this:
  1988.         (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)).
  1989.  
  1990.     BUFFER is the last buffer for which this symbol's value was
  1991.     made up to date.
  1992.  
  1993.         CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's
  1994.     b_local_var_alist, that being the element whose car is this variable.
  1995.         Or it can be a pointer to the (CURRENT-ALIST-ELEMENT .DEFAULT-VALUE),
  1996.     if BUFFER does not have an element in its alist for this variable
  1997.     (that is, if BUFFER sees the default value of this variable).
  1998.  
  1999.     If we want to examine or set the value and BUFFER is current,
  2000.     we just examine or set REALVALUE.
  2001.     If BUFFER is not current, we store the current REALVALUE value into
  2002.     CURRENT-ALIST-ELEMENT, then find the appropriate alist element for
  2003.     the buffer now current and set up CURRENT-ALIST-ELEMENT.
  2004.     Then we set REALVALUE out of that element, and store into BUFFER.
  2005.  
  2006.     If we are setting the variable and the current buffer does not have
  2007.     an alist entry for this variable, an alist entry is created.
  2008.  
  2009.     Note that REALVALUE can be a forwarding pointer.
  2010.     Each time it is examined or set, forwarding must be done.  
  2011.  
  2012. Lisp_Some_Buffer_Local_Value
  2013.     Like Lisp_Buffer_Local_Value with one difference:
  2014.     merely setting the variable while some buffer is current
  2015.     does not cause that buffer to have its own local value of this
  2016.     variable.  Only make-local-variable does that.  
  2017.  
  2018. Lisp_Buffer_Objfwd
  2019.     Like Lisp_Objfwd except that value lives in a slot
  2020.         in the current buffer.  Value is byte index of slot within buffer 
  2021.  
  2022. Lisp_Void
  2023.     In symbol value cell, means var is unbound.
  2024.         In symbol function cell, means function name is undefined. 
  2025.  
  2026. Lisp_Window
  2027.     Window used for Emacs display.
  2028.         Data inside looks like a Lisp_Vector.  
  2029.  
  2030. Lisp_Window_Configuration
  2031.     Used by save,set,restore-window-configuration 
  2032.  
  2033. Lisp_Extent
  2034.     An active region in buffer or string.  XEXTENT (obj) is
  2035.         typedef EXTENT. 
  2036.  
  2037. Lisp_Extent_Data
  2038.  
  2039. Lisp_Extent_Replica
  2040.  
  2041. Lisp_Float
  2042.  
  2043. Lisp_Event
  2044.  
  2045. Lisp_Keymap
  2046.  
  2047.     Lisp objects are created through various functions, some of which
  2048. just mirror just mirror Lisp primitives.  make_number() converts a
  2049. number into a Lisp_object, without allocating any space.  Fmake_vector()
  2050. creates a vector of a specified size.
  2051.  
  2052. ----------------------------------------------------------------------
  2053. ------------------------------- glyphs -------------------------------
  2054. ----------------------------------------------------------------------
  2055.  
  2056. [dispnew.c, xdisp.c]
  2057.  
  2058. A "glyph" is (more or less) a single character to be displayed on the
  2059. screen.  Note that a character in the text may be displayed as more than
  2060. one glyph (e.g. "^L" is normally displayed as two glyphs, ^ and L.)
  2061. Internally, a glyph is of type GLYPH, which is actually a 16-bit value
  2062. but normally just holds a regular character.
  2063.  
  2064. 1. structures
  2065.  
  2066. /* This structure is used for the actual display of text on a screen.
  2067.  
  2068.    There are two instantiations of it:  the glyphs currently displayed,
  2069.    and the glyphs we desire to display.  The latter object is generated
  2070.    from buffers being displayed. */
  2071.  
  2072. struct screen_glyphs
  2073.   {
  2074. #ifdef MULTI_SCREEN
  2075.     struct screen *screen;    /* Screen these glyphs belong to. */
  2076. #endif /* MULTI_SCREEN */
  2077.     int height;
  2078.     int width;
  2079.  
  2080.     int *used;            /* Vector of widths (in chars) of lines. */
  2081.     GLYPH **glyphs;        /* glyphs[Y][X] is the GLYPH at X,Y. */
  2082.     GLYPH *total_contents;    /* The actual contents. `glyphs' points here */
  2083.     char *enable;        /* Vector indicating meaningful contents. */
  2084.     int   *bufp;        /* Buffer offset of this line's first char. */
  2085.     int *nruns;            /* N runs of differently displayed text. */
  2086.     struct run **face_list;
  2087.     struct run *faces;
  2088.  
  2089. #ifdef HAVE_X_WINDOWS
  2090.     short *top_left_x;        /* Pixel position of top left corner */
  2091.     short *top_left_y;
  2092.     short *pix_width;        /* Pixel width of line. */
  2093.     short *pix_height;        /* Pixel height of line. */
  2094.     short *max_ascent;        /* Pixel value of max font->ascent of line. */
  2095. #endif    /* HAVE_X_WINDOWS */
  2096.   };
  2097.  
  2098. "struct screen_glyphs" is a complete description of what is currently
  2099. displayed on a screen.  The text is stored as a two-dimensional array
  2100. of glyphs along with a series of "runs" describing how the text is to
  2101. be displayed.  Each line has a number of such runs, and each run
  2102. describes how a particular chunk of text is to be displayed (i.e. if
  2103. there is a font change on a line, a new run will start there).
  2104.  
  2105. "screen" is the screen this structure refers to, and "height" and "width"
  2106. are the size of the screen in glyphs.  "pix_height" and "pix_width" are
  2107. arrays specifying the height and width of each line in pixels. (note that
  2108. "pix_height" includes the interline space) "max_ascent"
  2109. is an array specifying the maximum ascent of each line, in pixels -- i.e.
  2110. the maximum height the line extends above its baseline (each character is
  2111. made up of an ascent and a descent, and the total height of the character is
  2112. determined by adding these two values plus the interline space).
  2113.  
  2114. "used" is an array specifying,
  2115. for each line, the number of text characters (not glyphs) on that line.
  2116. "glyphs" is an array of vectors, each describing the glyphs on a line.
  2117. The vectors themselves are stored contiguously in "total_contents".  Note
  2118. that at the end of each line of glyphs there is a NULL_GLYPH.
  2119.  
  2120. "nruns" is an array specifying the number of runs on each line.  "face_list"
  2121. is an array of vectors, each listing the runs on a line.
  2122.  
  2123. "enable" is an array specifying, for each line, whether the glyph contents
  2124. of that line are valid.  For the "current glyphs" structure, this array
  2125. is reset when screen lines become garbaged.  For the "desired glyphs"
  2126. structure, this is reset when the structure is cleared out prior to
  2127. redisplay.
  2128.  
  2129. "top_left_x" and "top_left_y" are arrays specifying, for each line, the
  2130. pixel coordinate of the top left corner of the line.
  2131.  
  2132. 0. validating/invalidating lines of text
  2133.  
  2134. cancel_line(vpos, screen)
  2135.     Invalidate the specified line.  This resets the enable[] value in
  2136.     the screen's desired glyphs.
  2137. clear_screen_records(screen)
  2138.     Invalidate all the lines in the screen's current glyphs.
  2139.  
  2140. 1. converting text characters to glyphs; display tables
  2141.  
  2142. struct glyphs_from_chars
  2143.   {
  2144.     UCHAR c;
  2145.     GLYPH *glyphs;
  2146. #ifdef LINE_INFO_COLUMN
  2147.     Lisp_Object info_column_glyphs;
  2148. #endif
  2149.     int columns;
  2150.     struct face *faceptr;
  2151.     Lisp_Object begin_class[GLYPH_CLASS_VECTOR_SIZE];
  2152.     Lisp_Object end_class[GLYPH_CLASS_VECTOR_SIZE];
  2153.     short n_nonfont;
  2154.     int next_visible;
  2155.     UCHAR begin_or_end;        /* 0:none, 1:end, 2:begin, 3:both */
  2156. #ifdef HAVE_X_WINDOWS
  2157.     int begin_columns;
  2158.     int begin_pixel_width;
  2159.     int end_columns;
  2160.     int end_pixel_width;
  2161.     int pixel_width;
  2162.     int pixel_height;
  2163. #endif
  2164.     /* The chars in the buffer being processed that lie between
  2165.        [run_pos_lower, run_pos_upper] are promised to be in the same run,
  2166.        and to be separated from begin and/or end glyphs, provided they fit
  2167.        on the same line. This means that there are NO pixel-maps
  2168.        (sometimes called glyphs in other contexts) or font changes in the
  2169.        display of the chars in this range. It is NOT promised to be a
  2170.        maximal such range. */
  2171.     int run_pos_lower;
  2172.     int run_pos_upper;
  2173.   };
  2174.  
  2175. The "display table" controls the way characters are displayed.  There is
  2176. a default display table, [V]standard-display-table, and "display_table" is
  2177. a built-in buffer-local field in struct buffer.  A display table is a Lisp
  2178. vector of 261 elements.  The first 256 correspond to all possible
  2179. characters, and the last 5 refer to special characters (the "control glyph"
  2180. for displaying control characters, the "escape glyph" when characters are
  2181. displayed in octal, the "continuation glyph" for long lines, etc.) -- see
  2182. buffer.c, "buffer-display-table".  Each element is a "rope", which is a
  2183. string that is interpreted to be an array of glyphs, i.e. a double-character
  2184. string.  If an element of the display table is NIL, a default interpretation
  2185. is substituted.  The built-in buffer-local variable "ctl-arrow" controls
  2186. how the default is printed.  The defaults are:
  2187.  
  2188. 1) printable characters, and characters deemed to be printable through
  2189.    ctl-arrow: the character itself.
  2190. 2) control characters, if ctl-arrow is not nil: the "control glyph"
  2191.    followed by a printable glyph for the character.
  2192. 3) tab: the correct number of instances of TABGLYPH, which is defined to
  2193.    be '\t'.  (note that this substitution *always* happens; i.e. the rope
  2194.    for "tab" sitting in the display table is ignored.)
  2195. 4) other characters: the "escape glyph" followed by the octal representation
  2196.    of the character.
  2197. 5) the control glyph: ^.
  2198. 6) the escape glyph: \.
  2199.  
  2200.  
  2201. struct glyphs_from_chars is used to hold the glyphs corresponding to a
  2202. string of characters.  Some of the functions below return a pointer to
  2203. such a structure.  They use a static variable "char_glyphs".
  2204.  
  2205. GLYPH_SET_VALUE(g, v)
  2206.     Macro to set a glyph's value.  Just does "g = v".
  2207. GLYPH_FROM_CHAR(c)
  2208.     Converts a character to a glyph.  Just does (GLYPH) c.
  2209. struct glyphs_from_chars *
  2210. glyphs_from_char(screen, c, g, tab_width, ctl_arrow, fp, dp,
  2211.             hscroll, columns, tab_offset, pixel_values)
  2212.     Determines and returns the glyphs that correspond to a text character
  2213.     "c".  The glyphs are returned through "g", a pointer to an array of
  2214.     glyphs.  Also returns a pointer to "char_glyphs", which contains this
  2215.     same information plus values in the fields "columns", "pixel_width",
  2216.     and "pixel_height".  See above description of glyphs for a description
  2217.     of how this actually works.
  2218. update_cache(buffer, extfrag)
  2219.     Used by glyphs_from_bufpos() to cache the information last returned from
  2220.     buffer_extent_fragment_at().
  2221. struct glyphs_from_chars *
  2222. glyphs_from_bufpos (screen, buffer, pos, dp, hscroll, columns, tab_offset,
  2223.             direction, only_nonchars)
  2224.     Similar to glyphs_from_char() but also deals with "begin glyphs" and
  2225.     "end glyphs". (used only when XEmacs is linked with Energize)
  2226.     This requires looking at the extent
  2227.     fragment for the specified position.  Calculating an extent fragment is
  2228.     an expensive operation, so the last-calculated extent fragment is cached
  2229.     in case    it's still valid. (However, buffer_extent_fragment_at(), which
  2230.     is called to compute the extent fragment, does its own caching, so the
  2231.     caching done here is worthless.) "last_buffer", "last_screen",
  2232.     "last_buffer_modiff", "last_buffer_facechange", "last_buffer_extfrag",
  2233.     "last_extfrag_from_pos", "last_extfrag_to_pos", and "last_extfrag_face"
  2234.     are used to do the cachine.
  2235.         Some code is duplicated between this function and
  2236.     glyphs_from_chars().  Instead of using a user-supplied glyph array, the
  2237.     static variable "measure_glyphs" is used.   A pointer to the static
  2238.     variable "displayed_glyphs" is returned.
  2239.  
  2240. 2. begin and end glyphs
  2241.  
  2242. I'm not sure what these are, but they only seem to exist when XEmacs
  2243. is linked with Energize.  Some day I may figure out what they are and see
  2244. if they're neat feature, but not now.  Suffice to say, if ENERGIZE is not
  2245. defined there will never be any.
  2246.  
  2247. 3. runs
  2248.  
  2249. enum run_type
  2250. {
  2251.   unused_run,
  2252.   glyph,
  2253.   column_glyph,
  2254.   font,
  2255.   space,
  2256.   window            /* indicate a window change */
  2257. };
  2258.  
  2259. The run types are as follows:
  2260.  
  2261. unused_glyph:
  2262. glyph: a bitmap.
  2263. column_glyph:
  2264. font: characters to be displayed in a particular font.
  2265. space:
  2266. window:
  2267.  
  2268. struct run
  2269. {
  2270.   enum run_type type;
  2271.   int length;            /* Length in glyphs */
  2272.   struct face *faceptr;
  2273.   struct window* w;        /* window starting here */
  2274.   int bufp;            /* position in buffer */
  2275.   Lisp_Object class;        /* extent containing, if any */
  2276.   int begin_p;            /* 1 begin glyph 0 if end glyph*/
  2277. #ifdef HAVE_X_WINDOWS
  2278.   int pix_length;        /* Length in pixels */
  2279. #endif
  2280. #ifdef LINE_INFO_COLUMN
  2281.   int lineinfo_glyph_index;    /* Since glyphs in the lineinfo column don't
  2282.                    go into the glyphs array (because they
  2283.                    don't take up screen space) we need to
  2284.                    store them somewhere. */
  2285. #endif
  2286. };
  2287.  
  2288. A "run" is a part of a line of text that is to be displayed with a
  2289. particular characteristic.  If different parts of a line of text are
  2290. to be displayed with different characteristics, these different parts
  2291. will be described with different runs.  Runs are stored within a
  2292. struct screen_glyphs, as described above.
  2293.  
  2294. "struct run" specifies a run. "type" is the type of run, "length" the
  2295. number of glyphs in the run, "faceptr" the characteristics of the text
  2296. to be displayed, "w" the window in which the run occurs [check this??].
  2297.  
  2298. int new_run(screen, vpos, type, faceptr)
  2299.     Adds a new run to the screen's "desired_glyphs" structure.  "vpos"
  2300.     is the line on which the run occurs, and "type" and "faceptr" are
  2301.     the run's characteristics.  Returns the index of this run in the
  2302.     vector of runs for this line.
  2303. struct run *append_run(screen, vpos, type, class, faceptr, begin_p)
  2304.     Similar to new_run().  In addition, sets the run's "class" and "begin_p"
  2305.     values.  Return value is different.
  2306. void right_shift_runs(screen, vpos, run, nslots)
  2307.     Right-shift the lines on line "vpos" in the screen's "desired_glyphs"
  2308.     structure by "nslots" runs, starting at run "run".  The new slots
  2309.     are not initialized.
  2310. SET_RUN(screen, vpos, run, type, len, face, class, begin_p, pix_length)
  2311.     Initializes a run with the specified values.
  2312.  
  2313.  
  2314. 4. updating the glyphs in struct screen_glyphs
  2315.  
  2316. void append_glyph(screen, vpos, glyph, type, class, faceptr, begin_p)
  2317.     Adds a glyph to the screen's "desired_glyphs" structure, at the
  2318.     end of the line "vpos".  "type", "class" and "faceptr" specify
  2319.     the characteristics of this glyph; if the last run on the
  2320.     specified line does not match these characteristics, a new run
  2321.     is created.  The various arrays are updated as necessary.
  2322. void remove_glyph(screen, vpos)
  2323.     Removes the last glyph on line "vpos" in the screen's "desired_glyphs"
  2324.     structure.  If this causes the last run to shrink to zero glyphs in
  2325.     length, the run is removed.  All structures are updated as necessary
  2326.     except pix_height[].
  2327. void overlay_glyph(screen, vpos, glyph, type, class, faceptr, column, begin_p)
  2328.     Overlays the glyph at column "column" on line "vpos" in the screen's
  2329.     "desired_glyphs" structure.  "type", "class" and "faceptr" specify
  2330.     the characteristics of this glyph; if the run at the specified position
  2331.     does not match, that run is split as necessary and a new run inserted
  2332.     as necessary. (Note that the code does not currently handle the case
  2333.     where a run must be split in the middle) All structures are updated as
  2334.     necessary except pix_height[].  May call right_shift_runs() to insert
  2335.     a run.
  2336. int display_string(w, vpos, string, hpos, truncate, mincol, maxcol,
  2337.     this_face, pix_width_ptr)
  2338. /* Display NULL-terminated STRING on one line of window W, starting at HPOS.
  2339.    Display at position VPOS.  Caller should have done get_display_line.
  2340.  
  2341.    TRUNCATE is GLYPH to display at end if truncated.  Zero for none.
  2342.  
  2343.    MINCOL is the first column ok to end at.  (Pad with spaces to this col.)
  2344.    MAXCOL is the last column ok to end at.  Truncate here.
  2345.      -1 for MINCOL or MAXCOL means no explicit minimum or maximum.
  2346.    Both count from the left edge of the screen, as does HPOS.
  2347.    The right edge of W is an implicit maximum.
  2348.    If TRUNCATE is nonzero, the implicit maximum is one column before the edge.
  2349.  
  2350.    Display is performed using FACE, unless that is 0, then the screen
  2351.    default face is used.  Each new string on the smae line consitutes a
  2352.    different run.
  2353.  
  2354.    Returns ending hpos on the line.
  2355.  
  2356.    If PIX_WIDTH_PTR is nonzero, it is a pointer to an int variable that
  2357.    will be set to the pixel width of the string.   */
  2358.    Changes the "desired_glyphs" structure of the window's screen.  Pads
  2359.    as necessary with spaces to reach position "hpos"; then overlays or
  2360.    appends the glyphs, using overlay_glyph() or append_glyph().
  2361.    glyphs_from_char() is first called to convert a character to one or more
  2362.    glyphs; the standard display table [V]standard-display-table is used for
  2363.    this purpose. [why???] If the string needs to be truncated, any extra
  2364.    glyphs that got added beyond the end are removed and the glyph
  2365.    "TRUNCATOR_BITMAP" is added.  If necessary, the end is padded with spaces.
  2366.  
  2367. 5. displaying the mode line
  2368.  
  2369. decode_mode_spec()
  2370. display_mode_element()
  2371. display_mode_line()
  2372.  
  2373. 6. displaying the title
  2374.  
  2375. screen_title_display_string()
  2376. x_format_screen_title()
  2377.  
  2378.  
  2379. 9. other utility routines
  2380.  
  2381. run_from_glyph_index()
  2382. get_glyph_dimensions()
  2383. add_in_column_glyph()
  2384. int pixel_to_glyph_translation(struct screen *s, unsigned int pix_x,
  2385.     unsigned int pix_y, int *x,    int *y,    struct window **w, int *bufp,
  2386.     int *gly, Lisp_Object *class, int *begin_p)
  2387.  
  2388.     Determine the glyph under the pixel (pix_x, pix_y) on the screen "s".
  2389.     The glyph itself is returned in "gly", its coordinates in (x, y),
  2390.     the window containing these coordinates in "w", ...
  2391.  
  2392.  
  2393. 10. misc
  2394.  
  2395. init_xdisp()
  2396. syms_of_xdisp()
  2397.  
  2398. ----------------------------------------------------------------------
  2399. --------------------------- input blocking ---------------------------
  2400. ----------------------------------------------------------------------
  2401.  
  2402. what the hell is this?  This is found in free-hooks.c.  BLOCK_INPUT(),
  2403. UNBLOCK_INPUT(), and other such macros are called all over the place.
  2404.  
  2405.  
  2406. ----------------------------------------------------------------------
  2407. ------------------------------ main loop -----------------------------
  2408. ----------------------------------------------------------------------
  2409.  
  2410. The main loop is recursive-edit, which is called by main() and in
  2411. various other places.  recursive-edit and the functions below it do lots
  2412. of unwind-protecting, condition-casing, and catching because of the
  2413. possibility of a non-local exit from recursive-edit (see flowchart).  If
  2414. we are at the top level and "top-level" contains a Lisp form, it is
  2415. executed (this is set by loadup.el, which is normally run from the
  2416. command line when the original bare Emacs is converted to the full
  2417. version).  Normally "normal-top-level" (in startup.el) is called, and
  2418. processes the command line and does other such stuff.
  2419.  
  2420. command_loop_1() is then called, and it is the real main loop.  All it
  2421. does is loop until ^G is hit (or until a sub-function causes a non-local
  2422. exit), getting an event and dispatching it.
  2423.  
  2424. ----------------------------------------------------------------------
  2425. -------------------------------- menus -------------------------------
  2426. ----------------------------------------------------------------------
  2427.  
  2428. A menu is set by setting the value of the variable "current-menubar" (which
  2429. may be buffer-local) and then calling "set-menubar-dirty_flag" to signal
  2430. a change.  This will cause the menu to be redrawn at the next redisplay.
  2431. The format of the data in "current-menubar" is described in menubar.c.
  2432.  
  2433. Internally the data in current-menubar is parsed into a tree of
  2434. widget_value's (defined in lwlib.h); this is accomplished by the recursive
  2435. function menu_item_descriptor_to_widget_value(), called by
  2436. compute_menubar_data().  Such a tree is deallocated using
  2437. free_widget_value().
  2438.  
  2439. update_screen_menubars() is one of the external entry points.  This checks
  2440. to see, for each screen, if that screen's menubar needs to be updated.  This
  2441. is the case if
  2442.  
  2443. 1) set-menubar-dirty-flag was called since the last redisplay.  (This
  2444.    function sets the C variable menubar_has_changed.)
  2445. 2) The buffer displayed in the screen has changed.
  2446. 3) The screen has no menubar currently displayed.
  2447.  
  2448. set_screen_menubar() is called for each such screen.  This function calls
  2449. compute_menubar_data() to create the tree of widget_value's, then calls
  2450. lw_create_widget(), lw_modify_all_widgets(), and/or lw_destroy_all_widgets()
  2451. to create the X-Toolkit widget associated with the menu.
  2452.  
  2453. update_psheets(), the other external entry point, actually changes the menus
  2454. being displayed.  It uses the widgets fixed by update_screen_menubars() and
  2455. calls various X functions to ensure that the menus are displayed properly.
  2456.  
  2457. The menubar widget is set up so that pre_activate_callback() is called when
  2458. the menu is first selected (i.e. mouse button goes down), and
  2459. menubar_selection_callback() is called when an item is selected.
  2460. pre_activate_callback() calls the function in activate-menubar-hook, which
  2461. can change the menubar (this is described in menubar.c).  If the menubar 
  2462. is changed, set_screen_menubars() is called.  menubar_selection_callback()
  2463. enqueues a menu event, putting in it a function to call (either "eval"
  2464. or "call-interactively") and its argument, which is the callback function
  2465. or form given in the menu's description.
  2466.  
  2467.  
  2468. ----------------------------------------------------------------------
  2469. ----------------------------- minibuffers ----------------------------
  2470. ----------------------------------------------------------------------
  2471.  
  2472.  
  2473. ----------------------------------------------------------------------
  2474. ---------------------------- naming scheme ---------------------------
  2475. ----------------------------------------------------------------------
  2476.  
  2477. 'F...'    C functions corresponding to Lisp primitives
  2478. 'S...'    struct Lisp_Subr's corresponding to Lisp primitives
  2479. 'V...'    C variables tied to built-in Lisp variables
  2480. 'Q...'  C structures corresponding to Lisp constants, such as Qt and Qnil
  2481. 'QK..'  C variables holding Lisp_Objects containing keysym names
  2482.  
  2483.  
  2484. ----------------------------------------------------------------------
  2485. --------------------- naming scheme of functions ---------------------
  2486. ----------------------------------------------------------------------
  2487.  
  2488. All built-in primitives are Lisp objects of type Lisp_Subr.  They point
  2489. to a struct Lisp_Subr, which contains a pointer to the C function for
  2490. the primitive, the minimum and maximum number of arguments, a string
  2491. holding the name of the primitive, and a few other things.  The
  2492. corresponding C function is named by prepending an 'F' to the
  2493. primitive's name, and the corresponding struct Lisp_Subr is named by
  2494. prepending an 'S' to the primitive's name.  The macro DEFUN is used to
  2495. automate the C declarations of primitives.
  2496.  
  2497.  
  2498. ----------------------------------------------------------------------
  2499. ------------------------------- obarray ------------------------------
  2500. ----------------------------------------------------------------------
  2501.  
  2502. An obarray is a hash table that indexes strings to their corresponding
  2503. symbols.  obarrays are Lisp vectors of symbols.  Chaining is done
  2504. through a special, normally inaccessible field of struct Lisp_Symbol.
  2505. Emacs maintains a global obarray for all the interned strings.
  2506.  
  2507. OBARRAY_SIZE (manifest constant) [lread.c] is the size of the
  2508.     global obarray, which is 509.
  2509.  
  2510. Vobarray holds the global obarray.
  2511.  
  2512. init_obarray() [lread.c] allocates space for the global obarray and
  2513. initializes the obarray, which involves creating a few important
  2514. symbols and putting NIL into the obarray.
  2515.  
  2516. hash_string() [lread.c] hashes a string into an unsigned int.
  2517.  
  2518. check_obarray() [lread.c] makes sure that an obarray passed as an
  2519. argument to a Lisp function is the right type.
  2520.  
  2521. oblookup() [lread.c] looks up a string in an obarray, returning the
  2522. corresponding symbol if the string is found, or returning the hash value
  2523. otherwise.
  2524.  
  2525. map_obarray() [lread.c] applies a C function to every element in an
  2526. obarray.
  2527.  
  2528. Fmapatoms() [lread.c] is a Lisp primitive that does the same thing as
  2529. map_obarray().
  2530.  
  2531. Adding to an obarray is performed within the Fintern() function.
  2532.  
  2533. ----------------------------------------------------------------------
  2534. ---------------------------- point motion ----------------------------
  2535. ----------------------------------------------------------------------
  2536.  
  2537. ----------------------------------------------------------------------
  2538. ------------------------------ redisplay -----------------------------
  2539. ----------------------------------------------------------------------
  2540.  
  2541. 1. Important variables
  2542.  
  2543. selected_screen
  2544.     The currently selected screen (struct screen *).
  2545. selected_window
  2546.     The currently selected window on the currently selected screen
  2547.     (struct window *).
  2548. (struct screen).garbaged
  2549.     True if the screen needs to be completely redisplayed.
  2550. (struct screen).visible
  2551.     True if the screen is currently visible.  Changed by
  2552.     make-screen-visible and make-screen-invisible.
  2553. windows_or_buffers_changed
  2554.     Non-zero if any part of the display needs to change.
  2555. noninteractive
  2556.     True if we are not in an interactive Emacs (if Emacs was invoked with
  2557.     the -batch option).  In this case, nothing is displayed except for
  2558.     messages sent with message(), which are sent to stderr.
  2559. in_display
  2560.     True if we are currently updating the display.
  2561. Vscreen_list
  2562.     List of all the screens that currently exist.
  2563. clip_changed
  2564.     ?
  2565. redraw_mode_line
  2566.     Non-zero if the mode line for the current screen needs to be redrawn.
  2567.  
  2568. ----------------------------------------------------------------------
  2569. ------------------------------- screens ------------------------------
  2570. ----------------------------------------------------------------------
  2571.  
  2572. [from screen.h]
  2573.  
  2574. struct screen
  2575. {
  2576.   int size;
  2577.   struct Lisp_Vector *next;
  2578.  
  2579.   /* glyphs as they appear on the screen */
  2580.   struct screen_glyphs *current_glyphs;
  2581.  
  2582.   /* glyphs we'd like to appear on the screen */
  2583.   struct screen_glyphs *desired_glyphs;
  2584.  
  2585.   /* Cost of inserting 1 line on this screen */
  2586.   int *insert_line_cost;
  2587.  
  2588.   /* Cost of deleting 1 line on this screen */
  2589.   int *delete_line_cost;
  2590.  
  2591.   /* Cost of inserting n lines on this screen */
  2592.   int *insert_n_lines_cost;
  2593.  
  2594.   /* Cost of deleting n lines on this screen */
  2595.   int *delete_n_lines_cost;
  2596.  
  2597.   /* glyphs for the mode line */
  2598.   struct screen_glyphs *temp_glyphs;
  2599.  
  2600.   /* Intended cursor position of this screen.
  2601.      Measured in characters, counting from upper left corner
  2602.      within the screen.  */
  2603.   int cursor_x;
  2604.   int cursor_y;
  2605.  
  2606.   /* Is the cursor turned off? */
  2607.   int cursor_erased;
  2608.  
  2609.   /* Actual cursor position of this screen.
  2610.      (Not used for terminal screens.)  */
  2611.   int phys_cursor_x;
  2612.   int phys_cursor_y;
  2613.  
  2614.   /* Size of this screen, in units of characters.  */
  2615.   int height;
  2616.   int width;
  2617.  
  2618.   /* New height and width for pending size change.  0 if no change pending.  */
  2619.   int new_height, new_width;
  2620.  
  2621.   /* Name of this screen: a Lisp string.  */
  2622.   Lisp_Object name;
  2623.  
  2624.   /* This screen's root window.  Every screen has one.
  2625.      If the screen has only a minibuffer window, this is it.
  2626.      Otherwise, if the screen has a minibuffer window, this is its sibling.  */
  2627.   Lisp_Object root_window;
  2628.  
  2629.   /* This screen's selected window.
  2630.      Each screen has its own window hierarchy
  2631.      and one of the windows in it is selected within the screen.
  2632.      The selected window of the selected screen is Emacs's selected window.  */
  2633.   Lisp_Object selected_window;
  2634.  
  2635.   /* This screen's minibuffer window.
  2636.      Most screens have their own minibuffer windows,
  2637.      but only the selected screen's minibuffer window
  2638.      can actually appear to exist.  */
  2639.   Lisp_Object minibuffer_window;
  2640.  
  2641.   /* A copy of the global Vbuffer_list, to maintain a per-screen buffer
  2642.      ordering.  The Vbuffer_list variable and the buffer_list slot of each
  2643.      screen contain exactly the same data, just in different orders.  */
  2644.   Lisp_Object buffer_alist;
  2645.  
  2646.   /* Parameter alist of this screen.
  2647.      These are the parameters specified when creating the screen
  2648.      or modified with modify-screen-parameters.  */
  2649.   Lisp_Object param_alist;
  2650.  
  2651.   /* Vector representing the menubar currently displayed.  See menubar.c. */
  2652.   Lisp_Object menubar_data;
  2653.  
  2654.   /* The output method says how the contents of this screen
  2655.      are displayed.  It could be using termcap, or using an X window.  */
  2656.   enum output_method output_method;
  2657.  
  2658.   /* A structure of auxiliary data used for displaying the contents.
  2659.      struct x_display is used for X window screens;
  2660.      it is defined in xterm.h.  */
  2661.   union display { struct x_display *x; int nothing; } display;
  2662.  
  2663.   /* Nonzero if last attempt at redisplay on this screen was preempted.  */
  2664.   char display_preempted;
  2665.  
  2666.   /* Nonzero if screen is currently displayed.  */
  2667.   char visible;
  2668.  
  2669.   /* Nonzero if window is currently iconified.
  2670.      This and visible are mutually exclusive.  */
  2671.   char iconified;
  2672.  
  2673.   /* Nonzero if this screen should be redrawn.  */
  2674.   char garbaged;
  2675.  
  2676.   /* True if screen actually has a  minibuffer window on it.
  2677.      0 if using a minibuffer window that isn't on this screen.  */
  2678.   char has_minibuffer;
  2679.      
  2680.   /* 0 means, if this screen has just one window,
  2681.      show no modeline for that window.  */
  2682.   char wants_modeline;
  2683.  
  2684.   /* True if screen's root window can't be split.  */
  2685.   char no_split;
  2686.  
  2687.   /* Storage for messages to this screen. */
  2688.   char *message_buf;
  2689.  
  2690.   /* list of faces */
  2691.   struct face**    faces;
  2692.   int n_faces;
  2693.  
  2694.   /* the lisp data (shadowing the C data) */
  2695.   Lisp_Object face_alist;
  2696.  
  2697. #ifdef ENERGIZE
  2698.   DisplayContext*    display_context;
  2699. #endif
  2700. };
  2701.  
  2702. /* Each X screen object points to its own struct x_display object
  2703.    in the display.x field.  The x_display structure contains all
  2704.    the information that is specific to X windows.  */
  2705.  
  2706. struct x_display
  2707. {
  2708.   /* Position of the X window (x and y offsets in root window).  */
  2709.   int left_pos;
  2710.   int top_pos;
  2711.  
  2712.   /* Size of the X window in pixels, including internal border. */
  2713.   int pixel_height, pixel_width;
  2714. #ifdef DEADX
  2715.   /* Here are the Graphics Contexts for the default font. */
  2716.   GC normal_gc;                /* Normal video */
  2717.   GC reverse_gc;            /* Reverse video */
  2718.   GC cursor_gc;                /* cursor drawing */
  2719. #ifdef LINE_INFO_COLUMN
  2720.   GC line_info_gc;            /* lineinfo column */
  2721. #endif
  2722. #endif
  2723.  
  2724.   /* Width of the internal border.  This is a line of background color
  2725.      just inside the window's border.  When the screen is selected,
  2726.      a highlighting is displayed inside the internal border.  */
  2727.  
  2728.   int internal_border_width;
  2729.  
  2730. #ifdef LINE_INFO_COLUMN
  2731.   /* Width of the line info column.  The line info column appears to
  2732.      the left of the left margin, inside the internal border.  It is
  2733.      used to display glyphs related to each line. */
  2734.   int line_info_column_width;
  2735.   int default_line_info_column_width;
  2736. #ifdef DEADX
  2737.   PIX_TYPE line_info_background_pixel;
  2738. #endif
  2739.  
  2740.   FONT_TYPE *font;
  2741. #endif
  2742.   int text_height;
  2743.  
  2744.   /* Flag to set when the X window needs to be completely repainted. */
  2745.   int needs_exposure;
  2746.  
  2747. #ifdef DEADX
  2748.   /* The widget of this screen.  This is the window of a "shell" widget. */
  2749.   Widget widget;
  2750.   /* The XmPanedWindows... */
  2751.   Widget column_widget;
  2752. #ifdef LINE_INFO_WIDGET
  2753.   Widget row_widget;
  2754.   /* The widget of the line-info widget */
  2755.   Widget lineinfo_widget;
  2756. #endif
  2757.   /* The widget of the edit portion of this screen; the window in
  2758.      "window_desc" is inside of this. */
  2759.   Widget edit_widget;
  2760.  
  2761.   Widget menubar_widget;
  2762. #endif
  2763.  
  2764. #ifdef ENERGIZE
  2765.   /* The Energize property-sheets.  The current_ slots are the ones which are
  2766.      actually on the screen.  The desired_ slots are the ones which should
  2767.      be there.  Redisplay synchs these.
  2768.    */
  2769.   int *current_psheets;
  2770.   int *desired_psheets;
  2771.   int current_psheet_count;
  2772.   int desired_psheet_count;
  2773.   Lisp_Object current_psheet_buffer;
  2774.   Lisp_Object desired_psheet_buffer;
  2775. #endif
  2776.  
  2777.   /* This is true if we own the window, that is, it is not a window that
  2778.      was created by another process.  If we don't own the window, we aren't
  2779.      allowed to destroy it. "The window" referred to is always window_desc;
  2780.      if USE_WIDGET is true, we always own the window inside of the
  2781.      edit_widget. */
  2782.   char own_window;
  2783.  
  2784.   /* Whether this screen has the keyboard focus locked on it, whether the
  2785.      mouse is in this screen, and whether this is the screen currently
  2786.      receiving keyboard input.  In point-to-type mode, focus_p will never
  2787.      be true, and mouse_p and input_p will be the same.  In click-to-type
  2788.      mode, input_p will be the same as focus_p, and mouse_p will vary.
  2789.      Generally, input_p is the only interesting value, but the other two
  2790.      are necessary state to correctly interpret the interactions between
  2791.      FocusIn, FocusOut, EnterNotify, and LeaveNotify events.
  2792.      
  2793.      These must be per-screen properties instead of global variables,
  2794.      because screens are not necessarily on the same monitor, so more than
  2795.      one can have a mouse, and more than one can have keyboard focus.
  2796.    */
  2797.   char focus_p;
  2798.   char mouse_p;
  2799.   char input_p;
  2800.   
  2801.   /* 1 if the screen is completely visible on the display, 0 otherwise.
  2802.      if 0 the screen may have been iconified or may be totally
  2803.      or parrtially hidden by another X window */
  2804.   char totally_visible_p;
  2805. };
  2806.  
  2807. [
  2808. "text_height" is (more or less) the maximum height of any character that
  2809. might be displayed on the screens; specifically, it is the maximum, over
  2810. all the fonts displayed on the screen, of the sum of the font's "ascent"
  2811. and "descent" values.
  2812. ]
  2813.  
  2814. A "screen" corresponds to one window in the underlying windowing system.
  2815. In a non-windowing environment, there is only one screen, corresponding
  2816. to the entire screen.  Each "screen" is divided up into non-overlapping
  2817. "windows", which the windowing system knows nothing about.
  2818.  
  2819. Screens are allocated like windows -- i.e. allocated as vectors of the
  2820. proper size, and then the type of the Lisp_Object is set to Lisp_Screen.
  2821. The screens structure contains screen-specific properties such as the
  2822. screen's size, the cursor position, whether the cursor is displayed, the
  2823. tree of windows that the screen consists of, what the menus look like,
  2824. insertion/deletion costs, etc.  The actual text on the screen is held
  2825. in "current_glyphs", a pointer to a struct screen_glyphs (see "glyphs").
  2826. "desired_glyphs" points to another struct screen_glyphs, containing the
  2827. text that the screen should next display.
  2828.  
  2829. The window-system-specific information is held in "display" (and should
  2830. be a void pointer).  display.nothing is for accessing the value raw --
  2831. nothing == 0 means that the screen has been deleted (it will be garbage-
  2832. collected along with the rest of the vectors); nothing == 1 means that
  2833. this is a "terminal" screen (a screen corresponding to the entire
  2834. physical screen, used in non-windowing systems).  Window-system-specific
  2835. stuff is done by calling x_* functions; these functions manipulate the
  2836. display structure.
  2837.  
  2838. 1. variables
  2839.  
  2840. Vscreen_list points to a list of all the screens, chained through the
  2841. "next" field.  selected_screen is the screen currently selected.
  2842.  
  2843. 2. creating a screen
  2844.  
  2845. make_screen(), make_screen_without_minibuffer(),
  2846. make_minibuffer_screen(), and make_terminal_screen() allocate and
  2847. initialize a struct screen.  A root window (and optionally a minibuffer
  2848. window) is allocated.  The glyph structures are not allocated.
  2849. make_screen() actually does the work and takes a parameter indicating
  2850. whether to create a minibuffer window.  make_screen_without_minibuffer()
  2851. uses make_screen() to create a screen without its own minibuffer and
  2852. gives the screen either the specified minibuffer or the global
  2853. minibuffer, taken from "global-minibuffer-screen" (see "minibuffers").
  2854. make_minibuffer_screen() makes a screen without a minibuffer and then
  2855. converts the root window into a minibuffer.  make_terminal_screen()
  2856. creates a screen and sets some parameters to indicate that it's actually
  2857. the screen corresponding to stdio.  Only make_terminal_screen() changes
  2858. Vscreen_list.
  2859.  
  2860. delete-screen deletes a screen.  This involves setting display.nothing to 0,
  2861. removing the screen from Vscreen_list, and calling x_destroy_window() to
  2862. do the physical work.  Checks are performed to see if the currently selected
  2863. screen is being deleted, the global minibuffer screen is being deleted,
  2864. or the only screen is being deleted.
  2865.  
  2866. 3. selecting a screen
  2867.  
  2868. select-screen calls select_screen(), which sets selected_screen,
  2869. optionally runs the old screen's deselect-screen hook and the new
  2870. screen's select-screen hook, selects the screen's "selected_window",
  2871. sets the minibuffer, and calls x_new_selected_screen() and
  2872. x_focus_screen() to do the display work.
  2873.  
  2874. 4. information about screens
  2875.  
  2876. selected-screen, window-screen, screen-root-window, screenp, and
  2877. screen-selected-window return properties of screens.
  2878.  
  2879. 5. The screen list
  2880.  
  2881. Vscreen_list is the list of all the screens.  Elements are deleted from
  2882. it using Fdelq() and are added manually to the front.  screen-list,
  2883. next-screen, next_screen(), and prev_screen() return information about
  2884. the list of screens.
  2885.  
  2886. 5. mouse position
  2887.  
  2888. read_mouse_position(), read-mouse-position, set-mouse-position
  2889. [need more about this]
  2890.  
  2891. 6. screen visibility
  2892.  
  2893. make-screen-visible, make-screen-invisible, iconify-screen, deiconify-screen,
  2894. screen-visible-p, visible-screen-list [more about this], raise-screen,
  2895. lower-screen, screen-totally-visible-p
  2896.  
  2897. 7. screen properties
  2898.  
  2899. screen-height, screen-width, screen-name, internal_set_screen_size(),
  2900. set-screen-height, set-screen-width, set-screen-size, set-screen-position,
  2901.  
  2902. 8. coordinates
  2903.  
  2904. coordinates_in_window(), coordinates-in-window-p, window_from_coordinates(),
  2905. locate-window-from-coordinates
  2906.  
  2907. 9. misc
  2908.  
  2909. choose_minibuf_screen(), syms_of_screen()
  2910.  
  2911. 10. X functions and the screen.c functions that call them
  2912.  
  2913. x_new_selected_screen(screen *s)
  2914.     called by: select_screen()
  2915. x_focus_screen(screen *s)
  2916.     called by: select_screen()
  2917. x_destroy_window(screen *s, union display displ)
  2918.     called by: delete-screen
  2919. x_read_mouse_position(screen *s, int *x, int *y)
  2920.     called by: read_mouse_position()
  2921. x_set_mouse_position(screen *s, int x, int y)
  2922.     called by: set-mouse-position
  2923. x_make_screen_visible(screen *s)
  2924.     called by: make-screen-visible, deiconify-screen
  2925. x_make_screen_invisible(screen *s)
  2926.     called by: make-screen-invisible
  2927. x_iconify_screen(screen *s)
  2928.     called by: iconify-screen
  2929. x_report_screen_params(screen *s, Lisp_Object *alist)
  2930.     called by: screen-parameters
  2931. x_set_screen_values(screen *s, Lisp_Object alist)
  2932.     called by: modify-screen-parameters
  2933. x_set_window_size(screen *s, int cols, int rows)
  2934.     called by: internal_set_screen_size()
  2935. x_set_offset(screen *s, int x, int y)
  2936.     called by: set-screen-position
  2937. x_raise_screen(screen *s, int
  2938.     called by: raise-screen
  2939. x_lower_screen(screen *s)
  2940.     called by: lower-screen
  2941.  
  2942.  
  2943. ----------------------------------------------------------------------
  2944. ------------------------------- symbols ------------------------------
  2945. ----------------------------------------------------------------------
  2946.  
  2947. struct Lisp_Symbol
  2948.   {
  2949.     struct Lisp_String *name;
  2950.     Lisp_Object value;
  2951.     Lisp_Object function;
  2952.     Lisp_Object plist;
  2953.     struct Lisp_Symbol *next;    /* -> next symbol in this obarray bucket */
  2954.   };
  2955.  
  2956. [intern??]
  2957.  
  2958. ----------------------------------------------------------------------
  2959. -------------- symbol-values and buffer-local variables --------------
  2960. ----------------------------------------------------------------------
  2961.  
  2962. (code is contained in data.c)
  2963.  
  2964. Normally the value field of a symbol contains a Lisp object that is the
  2965. value of that symbol.  In some cases, however (depending on the type of
  2966. the object stored in the field), the value must be obtained by
  2967. indirection.  Here are the special types, and their descriptions in
  2968. lisp.h:
  2969.  
  2970. Lisp_Intfwd
  2971.     Forwarding pointer to an int variable.
  2972.         This is allowed only in the value cell of a symbol,
  2973.         and it means that the symbol's value really lives in the
  2974.         specified int variable.
  2975.         XINTPTR(obj) points to the int variable. 
  2976.  
  2977. Lisp_Boolfwd
  2978.     Boolean forwarding pointer to an int variable.
  2979.         This is like Lisp_Intfwd except that the ostensible
  2980.         "value" of the symbol is t if the int variable is nonzero,
  2981.         nil if it is zero.  XINTPTR(obj) points to the int variable. 
  2982.  
  2983. Lisp_Objfwd
  2984.     Forwarding pointer to a Lisp_Object variable.
  2985.         This is allowed only in the value cell of a symbol,
  2986.         and it means that the symbol's value really lives in the
  2987.         specified variable.
  2988.         XOBJFWD(obj) points to the Lisp_Object variable. 
  2989.  
  2990. Lisp_Buffer_Local_Value
  2991.     Used in a symbol value cell when the symbol's value is per-buffer.
  2992.         The actual contents are a cons cell which starts a list like this:
  2993.         (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)).
  2994.  
  2995.     BUFFER is the last buffer for which this symbol's value was
  2996.     made up to date.
  2997.  
  2998.         CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's
  2999.     b_local_var_alist, that being the element whose car is this variable.
  3000.         Or it can be a pointer to the (CURRENT-ALIST-ELEMENT .DEFAULT-VALUE),
  3001.     if BUFFER does not have an element in its alist for this variable
  3002.     (that is, if BUFFER sees the default value of this variable).
  3003.  
  3004.     If we want to examine or set the value and BUFFER is current,
  3005.     we just examine or set REALVALUE.
  3006.     If BUFFER is not current, we store the current REALVALUE value into
  3007.     CURRENT-ALIST-ELEMENT, then find the appropriate alist element for
  3008.     the buffer now current and set up CURRENT-ALIST-ELEMENT.
  3009.     Then we set REALVALUE out of that element, and store into BUFFER.
  3010.  
  3011.     If we are setting the variable and the current buffer does not have
  3012.     an alist entry for this variable, an alist entry is created.
  3013.  
  3014.     Note that REALVALUE can be a forwarding pointer.
  3015.     Each time it is examined or set, forwarding must be done.  
  3016.  
  3017. Lisp_Some_Buffer_Local_Value
  3018.     Like Lisp_Buffer_Local_Value with one difference:
  3019.     merely setting the variable while some buffer is current
  3020.     does not cause that buffer to have its own local value of this
  3021.     variable.  Only make-local-variable does that.  
  3022.  
  3023. Lisp_Buffer_Objfwd
  3024.     Like Lisp_Objfwd except that value lives in a slot
  3025.         in the current buffer.  Value is byte index of slot within buffer 
  3026.  
  3027. Lisp_Void
  3028.     In symbol value cell, means var is unbound.
  3029.         In symbol function cell, means function name is undefined. 
  3030.  
  3031.  
  3032. (from data.c, section "symbol-values")
  3033.  
  3034. C: do_symval_forwarding(), store_symval_forwarding(),
  3035. swap_in_symval_forwarding(), default_value() 
  3036.  
  3037. Lisp: symbol-value, set, default-boundp, default-value, set-default,
  3038. setq-default, make-variable-buffer-local, make-local-variable,
  3039. kill-local-variable
  3040.  
  3041.  
  3042.  
  3043. The forwarding types Lisp_Intfwd, Lisp_Boolfwd, and Lisp_Objfwd are used
  3044. when a Lisp variable mirrors the value of some C variable in the code.
  3045. [examples here] Such Lisp variables are defined with defvar_lisp(),
  3046. defvar_lisp_nopro(), defvar_bool(), and defvar_int() [lread.c].  Often,
  3047. the equivalent macros DEFVARLISP(), DEFVARBOOL(), DEFVARINT(),
  3048. DEFVAR_LISP(), DEFVAR_LISP_NOPRO(), DEFVAR_BOOL(), and DEFVAR_INT() are
  3049. used instead.  All of these functions simply intern the specified
  3050. variable and set the symbol's value field to the proper type and
  3051. pointer.  defvar_lisp() calls staticpro() on the Lisp variable pointed
  3052. to, while defvar_lisp_nopro() does not (see "allocation").
  3053.  
  3054. The type Lisp_Buffer_Objfwd refers to Lisp variables whose values mirror
  3055. per-buffer C variables held in fields ("slots") in struct buffer (each
  3056. such slot contains a Lisp object, and the slots are defined in
  3057. bufslots.h; see "buffers" for more information).  The value stored in
  3058. the symbol's value field is a byte offset into a struct buffer.
  3059. defvar_per_buffer() or the equivalent macros DEFVARPERBUFFER() or
  3060. DEFVAR_PER_BUFFER() define Lisp variables of this type.  Some such
  3061. variables have separate values for every buffer; others have default
  3062. values, just like for normal buffer-local variables.
  3063.  
  3064. The special struct buffer "buffer_local_symbols" contains, in each slot
  3065. for which a shadowing Lisp variable has been defined, a pointer to that
  3066. variable's symbol.  defvar_per_buffer() sets this.  struct buffer
  3067. "buffer_local_flags" indicates, for each slot, what the status of the
  3068. corresponding variable is: 0 in the slot means no variable exists; -1
  3069. means the variable is always local to each buffer; otherwise the slot
  3070. contains a mask value.  This mask value references a bit in the struct
  3071. buffer field "local_var_flags" indicating whether the corresponding
  3072. variable has its own value in this buffer.  Note that even when a buffer
  3073. does not have a local value for a particular slot variable, the slot in
  3074. that buffer will always contain the correct (i.e. default) value.
  3075. Setting a default value sets the slots of all buffers that do not have a
  3076. local value.  struct buffer "buffer_defaults" contains these default
  3077. values, for each slot that has one.  init_buffer_once() initializes
  3078. these special structs, and syms_of_buffer() defines most of the Lisp
  3079. variables that shadow slots.
  3080.  
  3081. do_symval_forwarding() accesses the value of a symbol, correctly dealing
  3082. with the four types of forwarding (it does not deal with normal
  3083. buffer-local variables, though -- see below).  Similarly,
  3084. store_symval_forwarding() stores a value in a symbol and deals with
  3085. forwarding types (it, too, does not deal with normal buffer-local
  3086. variables, nor does it change the flag in local_var_flags if a slot
  3087. variable formerly had no local value).  Note that symbol-value does not
  3088. actually call do_symval_forwarding(), but does exactly the equivalent
  3089. thing when dealing with forwarding pointers.
  3090.  
  3091. Normal buffer-local variables are tricky.  For each buffer that has its
  3092. own local value of a variable, there is an entry in the field
  3093. "local_var_alist" (an assoc-list associating symbols with values) in the
  3094. corresponding struct buffer.  In the value field of each buffer-local
  3095. variable's symbol is a list, as follows:
  3096.  
  3097. (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)
  3098.  
  3099. BUFFER is the last buffer in which this variable was accessed or
  3100. changed; REALVALUE is the current value of this variable in that buffer;
  3101. and CURRENT-ALIST-ELEMENT points to the entry for this variable in that
  3102. buffer's local_var_alist, or points to the cons (CURRENT-ALIST-ELEMENT .
  3103. DEFAULT-VALUE) if no local value exists.  Note that the assoc-list entry
  3104. pointed to by CURRENT-ALIST-ELEMENT may not contain the most recent
  3105. value of the variable, but REALVALUE always will.
  3106.  
  3107. swap_in_symval_forwarding() returns the value of a buffer-local variable
  3108. in the current buffer, and, if necessary, updates the list above for the
  3109. current buffer.
  3110.  
  3111. There's some more tricky complexity here depending on whether the
  3112. buffer-local variable is of type Lisp_Buffer_Local_Variable (if the
  3113. variable doesn't have a local value and you set it, a local value is
  3114. created) or Lisp_Some_Buffer_Local_Variable (local values are only
  3115. created by calling make-local-variable) and depending on whether the
  3116. default value for the variable (i.e. that value the variable had when
  3117. make-local-variable or make-variable-buffer-local) was a forwarding
  3118. pointer.  Look in set, symbol-value, default-value, default_value(),
  3119. default-boundp, set-default, setq-default, make-local-variable,
  3120. make-variable-buffer-local, kill-local-variable,
  3121. kill-all-local-variables [buffer.c].  It's truly ugly.
  3122.  
  3123. ----------------------------------------------------------------------
  3124. ------------------------------ windows -------------------------------
  3125. ----------------------------------------------------------------------
  3126.  
  3127. [from window.h]
  3128.  
  3129. /* Windows are allocated as if they were vectors, but then the
  3130. Lisp data type is changed to Lisp_Window.  They are garbage
  3131. collected along with the vectors.
  3132.  
  3133. All windows in use are arranged into a tree, with pointers up and down.
  3134.  
  3135. Windows that are leaves of the tree are actually displayed
  3136. and show the contents of buffers.  Windows that are not leaves
  3137. are used for representing the way groups of leaf windows are
  3138. arranged on the screen.  Leaf windows never become non-leaves.
  3139. They are deleted only by calling delete-window on them (but
  3140. this can be done implicitly).  Combination windows can be created
  3141. and deleted at any time.
  3142.  
  3143. A leaf window has a non-nil buffer field, and also
  3144.  has markers in its start and pointm fields.  Non-leaf windows
  3145.  have nil in these fields.
  3146.  
  3147. Non-leaf windows are either vertical or horizontal combinations.
  3148.  
  3149. A vertical combination window has children that are arranged on the screen
  3150. one above the next.  Its vchild field points to the uppermost child.
  3151. The parent field of each of the children points to the vertical
  3152. combination window.  The next field of each child points to the
  3153. child below it, or is nil for the lowest child.  The prev field
  3154. of each child points to the child above it, or is nil for the
  3155. highest child.
  3156.  
  3157. A horizontal combination window has children that are side by side.
  3158. Its hchild field points to the leftmost child.  In each child
  3159. the next field points to the child to the right and the prev field
  3160. points to the child to the left.
  3161.  
  3162. The children of a vertical combination window may be leaf windows
  3163. or horizontal combination windows.  The children of a horizontal
  3164. combination window may be leaf windows or vertical combination windows.
  3165.  
  3166. At the top of the tree are two windows which have nil as parent.
  3167. The second of these is minibuf_window.  The first one manages all
  3168. the screen area that is not minibuffer, and is called the root window.
  3169. Different windows can be the root at different times;
  3170. initially the root window is a leaf window, but if more windows
  3171. are created then that leaf window ceases to be root and a newly
  3172. made combination window becomes root instead.
  3173.  
  3174. In any case, prev of the minibuf window is the root window and
  3175. next of the root window is the minibuf window.  To find the
  3176. root window at any time, do XWINDOW (minibuf_window)->prev.
  3177.  
  3178. */
  3179.  
  3180. struct window
  3181.   {
  3182.     /* The first two fields are really the header of a vector */
  3183.     /* The window code does not refer to them.  */
  3184.     int size;
  3185.     struct Lisp_Vector *vec_next;
  3186.     /* The screen this window is on.  */
  3187.     Lisp_Object screen;
  3188.     /* t if this window is a minibuffer window.  */
  3189.     Lisp_Object mini_p;
  3190.     /* Following child (to right or down) at same level of tree */
  3191.     Lisp_Object next;
  3192.     /* Preceding child (to left or up) at same level of tree */
  3193.     Lisp_Object prev;
  3194.     /* First child of this window. */
  3195.     /* vchild is used if this is a vertical combination,
  3196.        hchild if this is a horizontal combination. */
  3197.     Lisp_Object hchild, vchild;
  3198.     /* The window this one is a child of. */
  3199.     Lisp_Object parent;
  3200.     /* The upper left corner coordinates of this window,
  3201.        as integers relative to upper left corner of screen = 0, 0 */
  3202.     Lisp_Object left;
  3203.     Lisp_Object top;
  3204.     /* The size of the window */
  3205.     Lisp_Object height;
  3206.     Lisp_Object width;
  3207.     /* The buffer displayed in this window */
  3208.     /* Of the fields vchild, hchild and buffer, only one is non-nil.  */
  3209.     Lisp_Object buffer;
  3210.     /* A marker pointing to where in the text to start displaying */
  3211.     Lisp_Object start;
  3212.     /* A marker pointing to where in the text point is in this window,
  3213.        used only when the window is not selected.
  3214.        This exists so that when multiple windows show one buffer
  3215.        each one can have its own value of point.  */
  3216.     Lisp_Object pointm;
  3217.     /* Non-nil means next redisplay must use the value of start
  3218.        set up for it in advance.  Set by scrolling commands.  */
  3219.     Lisp_Object force_start;
  3220.     /* Number of columns display within the window is scrolled to the left.  */
  3221.     Lisp_Object hscroll;
  3222.     /* Number saying how recently window was selected */
  3223.     Lisp_Object use_time;
  3224.     /* Unique number of window assigned when it was created */
  3225.     Lisp_Object sequence_number;
  3226.     /* No permanent meaning; used by save-window-excursion's bookkeeping */
  3227.     Lisp_Object temslot;
  3228.     /* text.modified of displayed buffer as of last time display completed */
  3229.     Lisp_Object last_modified;
  3230.     /* Value of point at that time */
  3231.     Lisp_Object last_point;
  3232.     /* buf.face_change as of last time display completed */
  3233.     Lisp_Object last_facechange;
  3234. /* The rest are currently not used or only half used */
  3235.     /* Screen coords of point at that time */
  3236.     Lisp_Object last_point_x;
  3237.     Lisp_Object last_point_y;
  3238.     /* Screen coords of mark as of last time display completed */
  3239.     /* May be nil if mark does not exist or was not on screen */
  3240.     Lisp_Object last_mark_x;
  3241.     Lisp_Object last_mark_y;
  3242.     /* Number of characters in buffer past bottom of window,
  3243.        as of last redisplay that finished. */
  3244.     Lisp_Object window_end_pos;
  3245.     /* t if window_end_pos is truly valid.
  3246.        This is nil if nontrivial redisplay is preempted
  3247.        since in that case the screen image that window_end_pos
  3248.        did not get onto the screen.  */
  3249.     Lisp_Object window_end_valid;
  3250.     /* Vertical position (relative to window top) of that buffer position
  3251.        of the first of those characters */
  3252.     Lisp_Object window_end_vpos;
  3253.     /* Non-nil means must regenerate mode line of this window */
  3254.     Lisp_Object redo_mode_line;
  3255.     /* Non-nil means current value of `start'
  3256.        was the beginning of a line when it was chosen.  */
  3257.     Lisp_Object start_at_line_beg;
  3258.     /* Display-table to use for displaying chars in this window.
  3259.        Nil means use the buffer's own display-table.  */
  3260.     Lisp_Object display_table;
  3261.     /* Non-nil means window is marked as dedicated.  */
  3262.     Lisp_Object dedicated;
  3263.   };
  3264.  
  3265. 1. general-purpose
  3266.  
  3267. make_window() creates and initializes a new window.  As described above,
  3268. a struct window is allocated and garbage-collected as a vector.  This
  3269. works because struct window and struct Lisp_Vector share their first few
  3270. fields; the remaining fields of struct window are all Lisp_Object's, and
  3271. these fields appear simply as elements of the vector. "sequence_number"
  3272. is used to assign a sequence number to a window; this variable is
  3273. incremented each time a window is created.
  3274.  
  3275. windowp asks whether a particular object is a Lisp_Window.
  3276. selected-window returns the window that the cursor appears in; this is
  3277. held in "selected_window".
  3278.  
  3279. ----------------------------------------------------------------------
  3280. ----------------------------- X interface ----------------------------
  3281. ----------------------------------------------------------------------
  3282.  
  3283. x_write_glyphs()
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290. ----------------------------------------------------------------------
  3291. -------------------------------- files -------------------------------
  3292. ----------------------------------------------------------------------
  3293.  
  3294. ----------------------------------------------------------------------
  3295. ColumnWidget.c
  3296. ----------------------------------------------------------------------
  3297.  
  3298.  
  3299.     some X stuff --?
  3300.  
  3301. ----------------------------------------------------------------------
  3302. EmacsShell.c
  3303. ----------------------------------------------------------------------
  3304.  
  3305.     more X stuff --?
  3306.  
  3307. ----------------------------------------------------------------------
  3308. ScreenWidget.c
  3309. ----------------------------------------------------------------------
  3310.  
  3311.     more X stuff --?
  3312.  
  3313. ----------------------------------------------------------------------
  3314. abbrev.c
  3315. ----------------------------------------------------------------------
  3316.  
  3317. Implements minor-mode "Abbrev". [section ??] [more detail here]
  3318.  
  3319. Lisp functions: make-abbrev-table, clear-abbrev-table, define-abbrev,
  3320. define-global-abbrev, define-mode-abbrev, abbrev-symbol,
  3321. abbrev-expansion, expand-abbrev, unexpand-abbrev,
  3322. insert-abbrev-table-description, define-abbrev-table
  3323.  
  3324. Lisp variables: abbrev-table-name-list, global-abbrev-table,
  3325. fundamental-mode-abbrev-table, last-abbrev, last-abbrev-text,
  3326. last-abbrev-location, abbrev-start-location,
  3327. abbrev-start-location-buffer, local-abbrev-table, abbrevs-changed,
  3328. abbrev-all-caps, pre-abbrev-expand-hook
  3329.  
  3330. C functions: write_abbrev(), describe_abbrev(), syms_of_abbrev()
  3331.  
  3332. C variables:
  3333.  
  3334. ----------------------------------------------------------------------
  3335. alloc.c (** system-dependent **)
  3336. ----------------------------------------------------------------------
  3337.  
  3338. A. low-level allocation
  3339.  
  3340. C functions: malloc_warning_1(), malloc_warning(), memory_full(),
  3341. xmalloc(), xrealloc()
  3342.  
  3343. B. allocation of particular types
  3344.  
  3345. 1. extents: EXTENT_BLOCK_SIZE, DUP_BLOCK_SIZE, struct extent_block,
  3346. struct dup_block, extent_block, extent_block_index, extent_free_list,
  3347. dup_block, dup_block_index, dup_free_list, init_extents(),
  3348. make_extent(), make_extent_replica()
  3349.  
  3350. 2. floats: FLOAT_BLOCK_SIZE, struct float_block, float_block,
  3351. float_block_index, float_free_list, init_float(), free_float(),
  3352. make_float()
  3353.  
  3354. 3. conses: CONS_BLOCK_SIZE, struct cons_block, cons_block,
  3355. cons_block_index, cons_free_list, init_cons(), free_cons()
  3356.  
  3357. Lisp: cons, list, make-list
  3358.  
  3359. 4. vectors: all_vectors
  3360.  
  3361. Lisp: make-vector, vector, make-byte-code
  3362.  
  3363. 5. symbols: SYMBOL_BLOCK_SIZE, struct symbol_block, symbol_block,
  3364. symbol_block_index, symbol_free_list, init_symbol()
  3365.  
  3366. Lisp: make-symbol
  3367.  
  3368. 6. markers: MARKER_BLOCK_SIZE, struct marker_block, marker_block,
  3369. marker_block_index, marker_free_list, init_marker()
  3370.  
  3371. Lisp: make-marker
  3372.  
  3373. 7. strings: PAD, ROUND_UP_STRING_SIZE(), STRING_FULL_SIZE(),
  3374. STRING_BLOCK_SIZE, STRING_CHARS_BLOCK_SIZE, struct string_chars,
  3375. SLOT_OFFSET(), CHARS_TO_STRING_CHAR(), struct string_chars_block, struct
  3376. string_block, string_block, string_block_index, string_free_list,
  3377. current_string_chars_block, first_string_chars_block,
  3378. NONRELOCATING_STRING_SIZE(), BIG_STRING_SIZE(), init_strings(),
  3379. make_string_internal(), allocate_string_chars(), make_uninit_string(),
  3380. make_string_from_buffer, make_string(), build_string()
  3381.  
  3382. Lisp: make-string
  3383.  
  3384. C. pure storage
  3385.  
  3386. C: tl, tf, ts, make_pure_string(), pure_cons(), make_pure_float(),
  3387. make_pure_vector()
  3388.  
  3389. Lisp: purecopy
  3390.  
  3391. D. garbage collection
  3392.  
  3393. C: gcprolist, NSTATICS, staticvec[], staticidx, staticpro(),
  3394. ARRAY_MARK_FLAG, BTL_before_Fgarbage_collect_stub(), total_conses,
  3395. total_markers, total_symbols, total_vector_size, total_string_size,
  3396. total_strings, total_short_strings, total_free_strings,
  3397. total_free_conses, total_free_markers, total_free_symbols,
  3398. total_free_flota, total_floats, total_free_events, total_events,
  3399. mark_one_extent(), mark_extents(), total_free_extents, total_extents,
  3400. total_free_dups, total_dups, current_pointer_shape, mark_object(),
  3401. mark_buffer(), mark_event(), mark_command_event_queue(), gc_sweep(),
  3402. compact_string_chars(), init_alloc_once(), init_alloc(), syms_of_alloc()
  3403.  
  3404. Lisp: garbage-collect
  3405.  
  3406. alloca.c (** system-dependent **)
  3407.  
  3408. Implementation of alloca(), which allocates memory space (originally off
  3409. the stack) that is automatically freed upon exit of the function.  This
  3410. version actually uses malloc(), and deallocates the space at some point
  3411. after the calling function has exited (upon each call to alloca() it
  3412. checks for stuff allocated in a lower stack frame)
  3413.  
  3414. ----------------------------------------------------------------------
  3415. buffer.c
  3416. ----------------------------------------------------------------------
  3417.  
  3418. Lots of stuff relating to buffers.  Code to create, destroy, select and
  3419. deselect buffers, return or change properties of a buffer, and do other
  3420. things that apply to a buffer as a whole.  No code to change the text in
  3421. a buffer or do low-level buffer-local-variable stuff.
  3422.  
  3423. current_buffer, all_buffers, buffer_defaults, buffer_local_flags,
  3424. buffer_local_symbols, check_protected_fields, nsberror(),
  3425. find_file_compare_truenames, file_file_use_truenames,
  3426. push_buffer_alist(), delete_from_buffer_alist(), buffer_count,
  3427. reset_buffer(), reset_buffer_local_variables(),
  3428. count_modified_buffers(), record_buffer(), internal_set_buffer(),
  3429. validate_region(), init_buffer_once(), init_buffer(), syms_of_buffer(),
  3430. keys_of_buffer()
  3431.  
  3432. Lisp: [V]buffer-defaults, [V]buffer-local-symbols, [V]buffer-alist,
  3433. [V]before-change-function, [V]after-change-function, [V]first-change-function,
  3434. [Q]fundamental-mode, [Q]mode-class, [Q]permanent-local,
  3435. [Q]protected_field, [QS]Fundamental, buffer-list, get-buffer,
  3436. get-file-buffer, get-buffer-create, generate-new-buffer, buffer-name,
  3437. buffer-file-name, buffer-local-variables, buffer-dedicated-screen,
  3438. set-buffer-dedicated-screen, buffer-modified-p, set-buffer-modified-p,
  3439. rename-buffer, other-buffer, buffer-disable-undo, buffer-enable-undo,
  3440. switch-to-buffer, pop-to-buffer, current-buffer, set-buffer,
  3441. barf-if-buffer-read-only, bury-buffer, erase-buffer,
  3442. kill-all-local-variables, region-fields, kill-buffer,
  3443. buffer-modified-tick
  3444.  
  3445. ----------------------------------------------------------------------
  3446. bytecode.c
  3447. ----------------------------------------------------------------------
  3448.  
  3449. Contains the function "byte-code", which is the byte-code interpreter.
  3450. It simulates a simple stack-based machine.
  3451.  
  3452. ----------------------------------------------------------------------
  3453. callint.c
  3454. ----------------------------------------------------------------------
  3455.  
  3456. Implements the functions call-interactively and prefix-numeric-value.
  3457. call-interactively scans through the function looking for an interactive
  3458. specification, and requests arguments for the user according to this
  3459. specification.  These arguments are then passed to the function.
  3460.  
  3461. C: num_input_chars, quotify_args(), callint_argfuns[], check_mark(),
  3462. syms_of_callint()
  3463.  
  3464. Lisp: [V]prefix-arg, [V]current-prefix-arg, [Q]minus,
  3465. [Q]call-interactively, [V]command-history, [V]command-debug-status,
  3466. [Q]command-debug-status, interactive, [V]current-mouse-event,
  3467. call-interactively, prefix-numeric-value
  3468.  
  3469. ----------------------------------------------------------------------
  3470. callproc.c (** system-dependent **)
  3471. ----------------------------------------------------------------------
  3472.  
  3473. Implements call-process and call-process-region, which synchronously
  3474. spawn a subprocess and place the output in a specified buffer.
  3475.  
  3476. C: synch_process_alive, synch_process_death, synch_process_retcode,
  3477. call_process_cleanup(), fork_error, report_fork_error(), child_setup(),
  3478. init_callproc(), syms_of_callproc()
  3479.  
  3480. Lisp: [V]exec-path, [V]exec-directory, [V]shell-file-name,
  3481. [V]process-environment, call-process, call-process-region, 
  3482.  
  3483. ----------------------------------------------------------------------
  3484. casefiddle.c
  3485. ----------------------------------------------------------------------
  3486.  
  3487. Implements Lisp functions that change the case of text.  Actual work is
  3488. done by casify_object() and casify_region().  They call macros UPCASE(),
  3489. DOWNCASE(), etc. defined in lisp.h.  These macros work by looking at the
  3490. case table for the buffer.  See also casetab.c.
  3491.  
  3492. C: enum case_action, casify_object(), casify_region(),
  3493. upcase_initials_region(), operate_on_word(), syms_of_casefiddle(),
  3494. keys_of_casefiddle()
  3495.  
  3496. Lisp: upcase, downcase, capitalize, upcase-region, downcase-region,
  3497. capitalize-region, upcase-word, downcase-word, capitalize-word
  3498.  
  3499. ----------------------------------------------------------------------
  3500. casetab.c
  3501. ----------------------------------------------------------------------
  3502.  
  3503. Implements functions that operate on case tables.  Case tables are
  3504. built-in buffer properties, stored in a struct buffer.  The
  3505. case-changing functions in casefiddle.c look at the case tables.
  3506.  
  3507. C: check_case_table(), set_case_table(), compute_trt_inverse(),
  3508. init_casetab_once(), syms_of_casetab()
  3509.  
  3510. Lisp: [Q]case-table-p, [V]ascii-downcase-table, [V]ascii-upcase-table,
  3511. [V]ascii-canon-table, [V]ascii-eqv-table, case-table-p,
  3512. current-case-table, standard-case-table, set-case-table,
  3513. set-standard-case-table
  3514.  
  3515. ----------------------------------------------------------------------
  3516. cm.c (** system-dependent **)
  3517. ----------------------------------------------------------------------
  3518.  
  3519. Provides an optimized, terminal-independent method for moving the cursor
  3520. to a specified location.  cmgoto() is the function that does this.
  3521.  
  3522. C: cost, evalcost(), cmputc(), addcol(), cmcostinit(), COST(), CMCOST(),
  3523. calccost(), cmgoto(), Wcm_clear(), Wcm_init()
  3524.  
  3525. ----------------------------------------------------------------------
  3526. cmds.c
  3527. ----------------------------------------------------------------------
  3528.  
  3529. Implements basic cursor motion and editing commands.
  3530. internal_self_insert() does the work of inserting a character, and has
  3531. special checks for overwrite mode, abbrevs (calls Fexpand_abbrev()),
  3532. auto-fill-mode (calls the current buffer's auto-fill function), and
  3533. paren-blinking (calls Vblink_paren_function).  Not pretty. [what about
  3534. zmacs_region_stays?]
  3535.  
  3536. C: zmacs_region_stays, internal_self_insert(), syms_of_cmds(),
  3537. keys_of_cmds()
  3538.  
  3539. Lisp: [Q]kill-forward-chars, [Q]kill-backward-chars,
  3540. [V]blink-paren-function, forward-char, backward-char, forward-line,
  3541. beginning-of-line, end-of-line, delete-char, delete-backward-char,
  3542. self-insert-command, newline
  3543.  
  3544. ----------------------------------------------------------------------
  3545. crt0.c (** system-dependent **)
  3546. ----------------------------------------------------------------------
  3547.  
  3548. This is a replacement for the standard system-dependent start-up routine
  3549. _start().  This replacement is necessary for VAX 4.2 but not for most
  3550. other machines.
  3551.  
  3552. ----------------------------------------------------------------------
  3553. data.c
  3554. ----------------------------------------------------------------------
  3555.  
  3556. Implements basic data manipulation routines for the Lisp interpreter
  3557. and some error-handling functions.  Includes code to handle buffer-local
  3558. variables.
  3559.  
  3560. 1. errors
  3561.  
  3562. C: wrong_type_argument(), pure_write_error(), args_out_of_range(),
  3563. args_out_of_range_3(), arith_error()
  3564.  
  3565. 2. integers
  3566.  
  3567. C: make_number(), sign_extend_temp, sign_extend_lisp_int()
  3568.  
  3569. 3. data type predicates
  3570.  
  3571. Lisp: eq, null, consp, atom, listp, nlistp, symbolp, vectorp, stringp,
  3572. arrayp, sequencep, bufferp, markerp, integer-or-marker-p, subrp,
  3573. compiled-function-p, char-or-string-p, integerp, natnump, floatp,
  3574. numberp, number-or-marker-p, extentp
  3575.  
  3576. 4. list manipulation
  3577.  
  3578. Lisp: car, car-safe, cdr, cdr-safe, setcar, setcdr
  3579.  
  3580. 5. symbol manipulation
  3581.  
  3582. Lisp: boundp, fboundp, makunbound, fmakunbound, symbol-function,
  3583. symbol-plist, symbol-name, fset, setplist
  3584.  
  3585. 6. symbol values
  3586.  
  3587. C: do_symval_forwarding(), store_symval_forwarding(),
  3588. swap_in_symval_forwarding(), default_value() 
  3589.  
  3590. Lisp: symbol-value, set, default-boundp, default-value, set-default,
  3591. setq-default, make-variable-buffer-local, make-local-variable,
  3592. kill-local-variable
  3593.  
  3594. 8. vector manipulation
  3595.  
  3596. C: Farray_length()
  3597.  
  3598. Lisp: aref, aset
  3599.  
  3600. 9. arithmetic
  3601.  
  3602. C: enum comparison, arithcompare(); enum arithop, arith_driver(),
  3603. float_arith_driver()
  3604.  
  3605. Lisp: =, <, >, <=, >=, /=, zerop; int-to-string, string-to-int; +, -, *,
  3606. /, %, max, min, logand, logior, logxor, ash, lsh, 1+, 1-, lognot
  3607.  
  3608. 10. misc: syms_of_data(), init_data()
  3609.  
  3610. ----------------------------------------------------------------------
  3611. dired.c (** system-dependent **)
  3612. ----------------------------------------------------------------------
  3613.  
  3614. Includes routines to obtain file and directory information.
  3615.  
  3616. Lisp: [V]completion-ignored-extensions, [Q]completion-ignore-case,
  3617. directory-files, file-name-completion, file-attributes
  3618.  
  3619. C: file_name_completion(), file_name_completion_stat(), make_time(),
  3620. syms_of_dired()
  3621.  
  3622. ----------------------------------------------------------------------
  3623. dispnew.c (** system-dependent **)
  3624. ----------------------------------------------------------------------
  3625.  
  3626. 1. general variables
  3627.  
  3628. C: screen_garbaged, display_completed, visible_bell, inverse_video,
  3629. baud_rate, cursor_in_echo_area, selected_screen, ophys_lines,
  3630. ophys_lines_length, termscript, Wcm, ospeed, in_display,
  3631. delayed_size_change, delayed_screen_height, delayed_screen_width
  3632.  
  3633. Lisp: [V]window-system, [V]window-system-version, [V]glyph-table,
  3634. [V]standard-display-table, [Q]cursor-in-echo-area
  3635.  
  3636. 2.
  3637.  
  3638. C: make_screen_glyphs(), free_screen_glyphs(), remake_screen_glyphs(),
  3639. line_hash_code(), line_draw_cost(), cancel_line(),
  3640. clear_screen_records(), get_display_line(), safe_bcopy(),
  3641. rotate_vector(), scroll_screen_lines(), preserve_other_columns(),
  3642. cancel_my_columns(), direct_output_for_insert(),
  3643. direct_output_forward_char(), count_blanks(), count_match(),
  3644. update_line(), x_update_line(), update_screen(), scrolling(),
  3645. pixel_to_glyph_translation(), window_change_signal(),
  3646. change_screen_size(), bitch_at_user()
  3647.  
  3648. Lisp: open-termscript, send-string-to-terminal, ding
  3649.  
  3650. 3. initialization
  3651.  
  3652. C: terminal_type, init_display(), syms_of_display()
  3653.  
  3654. Lisp: initialize-first-screen
  3655.  
  3656. ----------------------------------------------------------------------
  3657. doc.c
  3658. ----------------------------------------------------------------------
  3659.  
  3660. ----------------------------------------------------------------------
  3661. doprnt.c
  3662. ----------------------------------------------------------------------
  3663.  
  3664. ----------------------------------------------------------------------
  3665. editfns.c
  3666. ----------------------------------------------------------------------
  3667.  
  3668. ----------------------------------------------------------------------
  3669. editorside.c (** system-dependent **)
  3670. ----------------------------------------------------------------------
  3671.  
  3672. ----------------------------------------------------------------------
  3673. elhash.c
  3674. ----------------------------------------------------------------------
  3675.  
  3676. ----------------------------------------------------------------------
  3677. emacs.c:
  3678. ----------------------------------------------------------------------
  3679.  
  3680. This contains main().  main() is straightforward -- first it handles
  3681. some of the low-level options and traps some signals, then it proceeds to
  3682. initialization:
  3683.  
  3684.     1) initialize the various data structures
  3685.     2) intern the built-in symbols
  3686.     3) set the default key bindings
  3687.     4) miscellaneous (e.g. get the complete pathname of Emacs)
  3688.     5) enter the editing loop (Frecursive_edit)
  3689.  
  3690.  
  3691.  
  3692. ----------------------------------------------------------------------
  3693. environ.c
  3694. ----------------------------------------------------------------------
  3695.  
  3696.  
  3697. ----------------------------------------------------------------------
  3698. eval.c
  3699. ----------------------------------------------------------------------
  3700.  
  3701.  
  3702.  
  3703. ----------------------------------------------------------------------
  3704. event-Xt.c
  3705. ----------------------------------------------------------------------
  3706.  
  3707.  
  3708.  
  3709. ----------------------------------------------------------------------
  3710. event-alloc.c
  3711. ----------------------------------------------------------------------
  3712.  
  3713. This module contains routines that manage "struct Lisp_Event", which
  3714. holds the information for a single event.  These routines allocate,
  3715. de-allocate, and assist in garbage-collecting the structures.
  3716.  
  3717.  
  3718. C: event_free_list, struct event_block, event_blocks, event_block_index,
  3719. deinitialize_event(), get_more_events(), free_unmarked_events(),
  3720. prepare_to_gc_events(), syms_of_event_alloc()
  3721.  
  3722. Lisp: allocate-event, deallocate-event, copy-event
  3723.  
  3724. Not terribly interesting.  Events are managed just like cons cells.
  3725.  
  3726.  
  3727. ----------------------------------------------------------------------
  3728. event-stream.c
  3729. ----------------------------------------------------------------------
  3730.  
  3731.  
  3732. Lisp: [Q]undefined, [V]mouse-motion-handler, input-pending-p,
  3733. next-event, next-command-event, read-char, discard-input,
  3734. accept-process-output, dispatch-event, read-key-sequence
  3735.  
  3736. C: event_stream, struct command_builder, command_event_queue,
  3737. keystrokes, maybe_kbd_translate(), maybe_do_auto_save(), print_help(),
  3738. execute_help_form(), detect_input_pending(), enqueue_command_event(),
  3739. num_input_chars, next_event_internal(), deactivate_netconn(),
  3740. dispatch_event_internal(), syms_of_event_stream()
  3741.  
  3742. 2. timeout
  3743.  
  3744. Lisp: sleep-for, sit-for, sleep-for-millisecs, add-timeout,
  3745. disable-timeout
  3746.  
  3747. C: lisp_number_to_milliseconds(), wait_delaying_user_input()
  3748.  
  3749. 3. echo
  3750.  
  3751. C: echo_char_event(), echo_prompt(), echo_keystrokes, maybe_echo_keys(),
  3752. cancel_echoing()
  3753.  
  3754.  
  3755. ----------------------------------------------------------------------
  3756. events.c
  3757. ----------------------------------------------------------------------
  3758.  
  3759.  
  3760. 4. commands
  3761.  
  3762. Lisp: [V]this-command-keys
  3763.  
  3764. C: command_builder_find_leaf(), find_leaf_unwind(), recent_keys_ring,
  3765. recent_keys_ring_index, this_command_keys_count,
  3766. reset_this_command_keys, reset_this_command_keys_fn(),
  3767. push_command_keys_vector(), push_recent_keys_vector(),
  3768. store_recent_key(), command_builder_push(),
  3769. command_builder_push_meta_hack(), self_insert_countdown,
  3770. compose_command(), dispatch_command_event_internal(),
  3771. dispatch_menu_event()
  3772.  
  3773.  
  3774. ----------------------------------------------------------------------
  3775. extents.c
  3776. ----------------------------------------------------------------------
  3777.  
  3778.  
  3779.  
  3780. ----------------------------------------------------------------------
  3781. faces.c
  3782. ----------------------------------------------------------------------
  3783.  
  3784.  
  3785. ----------------------------------------------------------------------
  3786. fileio.c
  3787. ----------------------------------------------------------------------
  3788.  
  3789.  
  3790. ----------------------------------------------------------------------
  3791. filelock.c
  3792. ----------------------------------------------------------------------
  3793.  
  3794.  
  3795. ----------------------------------------------------------------------
  3796. filemode.c
  3797. ----------------------------------------------------------------------
  3798.  
  3799.  
  3800.  
  3801. ----------------------------------------------------------------------
  3802. floatfns.c
  3803. ----------------------------------------------------------------------
  3804.  
  3805.  
  3806. ----------------------------------------------------------------------
  3807. fns.c
  3808. ----------------------------------------------------------------------
  3809.  
  3810.  
  3811.  
  3812. ----------------------------------------------------------------------
  3813. free-hook.c
  3814. ----------------------------------------------------------------------
  3815.  
  3816.  
  3817. ----------------------------------------------------------------------
  3818. gmalloc.c
  3819. ----------------------------------------------------------------------
  3820.  
  3821.  
  3822. ----------------------------------------------------------------------
  3823. hash.c
  3824. ----------------------------------------------------------------------
  3825.  
  3826.  
  3827. ----------------------------------------------------------------------
  3828. indent.c
  3829. ----------------------------------------------------------------------
  3830.  
  3831.  
  3832. ----------------------------------------------------------------------
  3833. insdel.c
  3834. ----------------------------------------------------------------------
  3835.  
  3836.  
  3837. ----------------------------------------------------------------------
  3838. keyboard.c
  3839. ----------------------------------------------------------------------
  3840.  
  3841. Lisp: [Q]disabled, [V]disabled-command-hook, [V]help-form,
  3842. [V]global-function-map, [V]last-command-event, [V]last-command-char,
  3843. [V]last-input-event, [V]last-input-char, [V]unread-command-event,
  3844. [V]last-command, [V]this-command, [V]last-input-time,
  3845. [V]mouse-left-hook, [V]mouse-enter-hook, [V]map-screen-hook,
  3846. [V]unmap-screen-hook, [V]mouse-motion-handler, [Q]self-insert-command,
  3847. [Q]forward-char, [Q]backward-char, [V]top-level,
  3848. [V]keyboard-translate-table, command-execute,
  3849. execute-extended-command, recent-keys, this-command-keys,
  3850. recursion-depth, open-dribble-file, suspend-emacs, set-input-mode 
  3851.  
  3852. C: waiting_for_input, immediate_quit, help_char, interrupt_char,
  3853. current_global_map, minibuf_level, echo_area_glyphs, command_loop_level,
  3854. num_input_keys, dribble, meta_key, input_available_clear_word,
  3855. interrupt_input, interrupts_deferred, flow_control, keyboard_init_hook,
  3856. polling_period, polling_for_input, poll_suppress_count,
  3857. input_poll_signal(), start_polling(), stop_polling(),
  3858. input_available_signal(), map_prompt(), stuff_buffered_input(),
  3859. set_waiting_for_input(), clear_waiting_for_input(), interrupt_signal(),
  3860. init_keyboard(), syms_of_keyboard(), keys_of_keyboard()  
  3861.  
  3862. recursive-edit (main loop)
  3863.  
  3864. C: recursive_edit_1(), recursive_edit_unwind(), cmd_error(),
  3865. command_loop(), command_loop_2(), top_level_2(), top_level_1(),
  3866. command_loop_1()
  3867.  
  3868. Lisp: recursive-edit, top-level, exit-recursive-edit, abort-recursive-edit
  3869.  
  3870. ----------------------------------------------------------------------
  3871. keymap.c
  3872. ----------------------------------------------------------------------
  3873.  
  3874.  
  3875. ----------------------------------------------------------------------
  3876. lastfile.c
  3877. ----------------------------------------------------------------------
  3878.  
  3879.  
  3880. ----------------------------------------------------------------------
  3881. libsst.c
  3882. ----------------------------------------------------------------------
  3883.  
  3884.  
  3885. ----------------------------------------------------------------------
  3886. lread.c:
  3887. ----------------------------------------------------------------------
  3888.  
  3889.  
  3890. 1. Lisp I/O and parsing
  3891.  
  3892. Lisp: [Q]read-char, [Q]get-file-char, [Q]standard-input,
  3893. [Q]variable-documentation, [V]values, [V]standard-input,
  3894. [V]after-load-alist, [V]load-path, get-file-char, load, locate-file,
  3895. eval-buffer, eval-region, read, read-from-string, 
  3896.  
  3897. C: load_in_progress, instream, read_pure, read_from_string_index,
  3898. read_from_string_limit, READCHAR, UNREAD(), readchar(), unreadchar(),
  3899. load_unwind(), comlete_filename_p(), locate_file(), unreadpure(),
  3900. readevalloop(), read0(), read_buffer_size, read_buffer, read_escape(),
  3901. read1(), isfloat_string(), read_vector(), read_list(), init_read(),
  3902. syms_of_read()
  3903.  
  3904. 2. obarray
  3905.  
  3906. Lisp: [V]obarray, intern, intern-soft, mapatoms 
  3907.  
  3908. C: initial_obarray, check_obarray(), intern(), oblookup(),
  3909. hash_string(), map_obarray(), mapatoms_1(), OBARRAY_SIZE, init_obarray()
  3910.  
  3911. 3. defining Lisp symbols
  3912.  
  3913. C: defsubr(), defalias(), defvar_int(), defvar_bool(), defvar_lisp(),
  3914. defvar_lisp_nopro(), defvar_per_buffer() 
  3915.  
  3916.  
  3917. ----------------------------------------------------------------------
  3918. macros.c
  3919. ----------------------------------------------------------------------
  3920.  
  3921.  
  3922. ----------------------------------------------------------------------
  3923. malloc.c
  3924. ----------------------------------------------------------------------
  3925.  
  3926.  
  3927. ----------------------------------------------------------------------
  3928. marker.c
  3929. ----------------------------------------------------------------------
  3930.  
  3931.  
  3932. ----------------------------------------------------------------------
  3933. menubar.c
  3934. ----------------------------------------------------------------------
  3935.  
  3936.  
  3937. ----------------------------------------------------------------------
  3938. menuitems.c
  3939. ----------------------------------------------------------------------
  3940.  
  3941.  
  3942. ----------------------------------------------------------------------
  3943. minibuf.c
  3944. ----------------------------------------------------------------------
  3945.  
  3946.  
  3947. ----------------------------------------------------------------------
  3948. mocklisp.c
  3949. ----------------------------------------------------------------------
  3950.  
  3951.  
  3952. ----------------------------------------------------------------------
  3953. play.c
  3954. ----------------------------------------------------------------------
  3955.  
  3956.  
  3957. ----------------------------------------------------------------------
  3958. pre-crt0.c
  3959. ----------------------------------------------------------------------
  3960.  
  3961.  
  3962. ----------------------------------------------------------------------
  3963. print.c
  3964. ----------------------------------------------------------------------
  3965.  
  3966.  
  3967. ----------------------------------------------------------------------
  3968. process.c
  3969. ----------------------------------------------------------------------
  3970.  
  3971.  
  3972. ----------------------------------------------------------------------
  3973. ralloc.c
  3974. ----------------------------------------------------------------------
  3975.  
  3976.  
  3977. ----------------------------------------------------------------------
  3978. realpath.c
  3979. ----------------------------------------------------------------------
  3980.  
  3981.  
  3982. ----------------------------------------------------------------------
  3983. regex.c
  3984. ----------------------------------------------------------------------
  3985.  
  3986.  
  3987. ----------------------------------------------------------------------
  3988. screen.c
  3989. ----------------------------------------------------------------------
  3990.  
  3991. Routines dealing with "struct screen".  This structure contains
  3992. information about an Emacs "screen", which corresponds to a window in
  3993. the windowing system.  Each "screen" is divided up into Emacs's own
  3994. non-overlapping "windows", which the windowing system knows nothing
  3995. about.
  3996.  
  3997. Many of these routines call routines in xterm.c to actually change the
  3998. physical display.
  3999.  
  4000. ----------------------------------------------------------------------
  4001. scroll.c
  4002. ----------------------------------------------------------------------
  4003.  
  4004.  
  4005. ----------------------------------------------------------------------
  4006. search.c
  4007. ----------------------------------------------------------------------
  4008.  
  4009.  
  4010. ----------------------------------------------------------------------
  4011. sunOS-fix.c
  4012. ----------------------------------------------------------------------
  4013.  
  4014.  
  4015. ----------------------------------------------------------------------
  4016. sunfns.c
  4017. ----------------------------------------------------------------------
  4018.  
  4019.  
  4020. ----------------------------------------------------------------------
  4021. syntax.c
  4022. ----------------------------------------------------------------------
  4023.  
  4024.  
  4025. ----------------------------------------------------------------------
  4026. sysdep.c
  4027. ----------------------------------------------------------------------
  4028.  
  4029.  
  4030. ----------------------------------------------------------------------
  4031. term.c
  4032. ----------------------------------------------------------------------
  4033.  
  4034.  
  4035. ----------------------------------------------------------------------
  4036. termcap.c
  4037. ----------------------------------------------------------------------
  4038.  
  4039.  
  4040. ----------------------------------------------------------------------
  4041. terminfo.c
  4042. ----------------------------------------------------------------------
  4043.  
  4044.  
  4045. ----------------------------------------------------------------------
  4046. tparam.c
  4047. ----------------------------------------------------------------------
  4048.  
  4049.  
  4050. ----------------------------------------------------------------------
  4051. undo.c
  4052. ----------------------------------------------------------------------
  4053.  
  4054.  
  4055. ----------------------------------------------------------------------
  4056. unexconvex.c
  4057. ----------------------------------------------------------------------
  4058.  
  4059.  
  4060. ----------------------------------------------------------------------
  4061. unexec.c
  4062. ----------------------------------------------------------------------
  4063.  
  4064.  
  4065. ----------------------------------------------------------------------
  4066. unexelf.c
  4067. ----------------------------------------------------------------------
  4068.  
  4069.  
  4070. ----------------------------------------------------------------------
  4071. unexencap.c
  4072. ----------------------------------------------------------------------
  4073.  
  4074.  
  4075. ----------------------------------------------------------------------
  4076. unexenix.c
  4077. ----------------------------------------------------------------------
  4078.  
  4079.  
  4080. ----------------------------------------------------------------------
  4081. unexhp9k800.c
  4082. ----------------------------------------------------------------------
  4083.  
  4084.  
  4085. ----------------------------------------------------------------------
  4086. unexmips.c
  4087. ----------------------------------------------------------------------
  4088.  
  4089.  
  4090. ----------------------------------------------------------------------
  4091. unexsunos4.c
  4092. ----------------------------------------------------------------------
  4093.  
  4094.  
  4095. ----------------------------------------------------------------------
  4096. vm-limit.c
  4097. ----------------------------------------------------------------------
  4098.  
  4099.  
  4100. ----------------------------------------------------------------------
  4101. vms-pp.c
  4102. ----------------------------------------------------------------------
  4103.  
  4104.  
  4105. ----------------------------------------------------------------------
  4106. vmsfns.c
  4107. ----------------------------------------------------------------------
  4108.  
  4109.  
  4110. ----------------------------------------------------------------------
  4111. vmsmap.c
  4112. ----------------------------------------------------------------------
  4113.  
  4114.  
  4115. ----------------------------------------------------------------------
  4116. vmsproc.c
  4117. ----------------------------------------------------------------------
  4118.  
  4119.  
  4120. ----------------------------------------------------------------------
  4121. window.c
  4122. ----------------------------------------------------------------------
  4123.  
  4124.  
  4125. ----------------------------------------------------------------------
  4126. xdisp.c (** system-dependent **)
  4127. ----------------------------------------------------------------------
  4128.  
  4129. 1. variables
  4130.  
  4131. C: noninteractive_need_newline, this_line_bufpos, this_line_endpos,
  4132. this_line_vpos, this_line_start_hpos, this_line_buffer,
  4133. previous_echo_glyphs, last_arrow_position, last_arrow_string,
  4134. overlay_arrow_seen, scroll_step, blank_end_of_window, buffer_shared,
  4135. cursor_vpos, cursor_hpos, debug_end_pos, mode_line_inverse_video,
  4136. minibuf_prompt, minibuf_prompt_width, minibuf_prompt_pix_width,
  4137. echo_area_buffer, echo_area_glyphs, redraw_mode_line, beg_unchanged,
  4138. end_unchanged, unchanged_modified, clip_changed,
  4139. windows_or_buffers_changed
  4140.  
  4141. Lisp: [V]global-mode-string, [V]overlay-arrow-position,
  4142. [V]overlay-arrow-string, [V]minibuffer-list
  4143.  
  4144. 2.
  4145.  
  4146. C: redraw_screen(), echo_area_display(), message_buf, message(),
  4147. redisplay(), redisplay_preserving_echo_area(),
  4148. mark_window_display_accurate(), redisplay_windows(), redisplay_window(),
  4149. initialize_first_screen(), try_window(), try_window_id(), copy_rope()
  4150.  
  4151. Lisp: redraw-display
  4152.  
  4153. 3.
  4154.  
  4155. C: char_glyphs(), measure_glyphs, GLYPH_SET_VALUE(), glyphs_from_char(),
  4156. last_buffer, last_screen, last_buffer_modiff, last_buffer_facechange,
  4157. last_buffer_extfrag, last_extfrag_from_pos, last_extfrag_to_pos,
  4158. last_extfrag_face, displayed_glyphs, update_cache(),
  4159. glyphs_from_bufpos(), new_run(), glyph_pixel_width(), stuff_glyph(),
  4160. install_first_runs(), append_run(), append_glyph(), [it goes on]
  4161.  
  4162.  
  4163. ----------------------------------------------------------------------
  4164. xfns.c
  4165. ----------------------------------------------------------------------
  4166.  
  4167.  
  4168. ----------------------------------------------------------------------
  4169. xselect.c
  4170. ----------------------------------------------------------------------
  4171.  
  4172.  
  4173. ----------------------------------------------------------------------
  4174. xterm.c [2729 lines] [** system-dependent **]
  4175. ----------------------------------------------------------------------
  4176.  
  4177. This module contains functions that interface between Emacs and the
  4178. X display routines.
  4179.  
  4180. ----------------------------------------------------------------------
  4181. xutils.c [158 lines]
  4182. ----------------------------------------------------------------------
  4183.  
  4184.  
  4185.  
  4186. #fff#        config.h    free-hook.c    ndir.h        terminfo.c
  4187. COPYING        config.h-dist    getpagesize.h    param.h        termopts.h
  4188. ColumnWidget.c    connmemory.h    glyfs.h        paths.h        tparam.c
  4189. ColumnWidget.h    crt0.c        gmalloc.c    paths.h-dist    uaf.h
  4190. ColumnWidgetP.h    data.c        gnu.h        play.c        undo.c
  4191. EmacsShell.c    dir.h        hash.c        pre-crt0.c    unexconvex.c
  4192. EmacsShell.h    dired.c        hash.h        print.c        unexec.c
  4193. EmacsShellP.h    dispextern.h    indent.c    process.c    unexelf.c
  4194. FILES        dispnew.c    indent.h    process.h    unexencap.c
  4195. Makefile    disptab.h    insdel.c    puresize.h    unexenix.c
  4196. README        doc.c        ioctl.h        pwd.h        unexhp9k800.c
  4197. ScreenWidget.c    doprnt.c    keyboard.c    ralloc.c    unexmips.c
  4198. ScreenWidget.h    editfns.c    keymap.c    realpath.c    unexsunos4.c
  4199. ScreenWidgetP.h    editorside.c    keymap.h    regex.c        vlimit.h
  4200. abbrev.c    editorside.h    lastfile.c    regex.h        vm-limit.c
  4201. acldef.h    elhash.c    lemacs*        s/        vms-pp.c
  4202. alloc.c        emacs.c        libsst.c    screen.c    vmsfns.c
  4203. alloca.c    environ.c    libsst.h    screen.h    vmsmap.c
  4204. backtrace.h    eval.c        line.h        scroll.c    vmspaths.h
  4205. bitmaps.h    event-Xt.c    lisp.h        search.c    vmsproc.c
  4206. blockio.h    event-alloc.c    lread.c        sink.h        vmsproc.h
  4207. buffer.c    event-stream.c    lwlib/        sink11.h    window.c
  4208. buffer.h    events.c    m/        sink11mask.h    window.h
  4209. bufslots.h    events.h    m-delta.h    sinkmask.h    x11term.h
  4210. bytecode.c    extents-data.h    macros.c    sunOS-fix.c    xdisp.c
  4211. callint.c    extents.c    macros.h    sunfns.c    xfns.c
  4212. callproc.c    extents.h    malloc.c    syntax.c    xselect.c
  4213. casefiddle.c    faces.c        marker.c    syntax.h    xterm.c
  4214. casetab.c    faces.h        mem_limits.h    sysdep.c    xterm.h
  4215. chpdef.h    fileio.c    menubar.c    tags        xutils.c
  4216. cm.c        filelock.c    menuitems.c    term.c        ymakefile
  4217. cm.h        filemode.c    menuitems.h    termcap.c
  4218. cmds.c        floatfns.c    minibuf.c    termchar.h
  4219. commands.h    fns.c        mocklisp.c    termhooks.h
  4220.  
  4221.      323    1106    9924 ColumnWidget.c
  4222.      497    1507   14727 EmacsShell.c
  4223.      603    1850   18835 ScreenWidget.c
  4224.      559    2134   17245 abbrev.c
  4225.     2173    6770   55031 alloc.c
  4226.      191     813    5217 alloca.c
  4227.     1749    7269   57759 buffer.c
  4228.     1160    3129   22649 bytecode.c
  4229.      591    2436   17504 callint.c
  4230.      581    2069   15289 callproc.c
  4231.      268    1029    7432 casefiddle.c
  4232.      251     952    7406 casetab.c
  4233.      414    1651   10042 cm.c
  4234.      373    1351   10019 cmds.c
  4235.      534    2006   13346 crt0.c
  4236.     1976    6797   53950 data.c
  4237.      502    1936   14357 dired.c
  4238.     2388    8358   67503 dispnew.c
  4239.      465    1864   13021 doc.c
  4240.      137     558    3635 doprnt.c
  4241.     1363    5380   38484 editfns.c
  4242.     4143   11784  114483 editorside.c
  4243.      441    1244   11139 elhash.c
  4244.     1126    3733   27718 emacs.c
  4245.      316    1133    7780 environ.c
  4246.     2340    8342   62039 eval.c
  4247.     1607    5986   51340 event-Xt.c
  4248.      266    1094    8091 event-alloc.c
  4249.     1790    6902   55205 event-stream.c
  4250.      748    2997   24085 events.c
  4251.     2926   10080   85426 extents.c
  4252.      974    3196   25777 faces.c
  4253.     3117   12253   84469 fileio.c
  4254.      401    1400   10011 filelock.c
  4255.      199     747    4685 filemode.c
  4256.      551    1801   12180 floatfns.c
  4257.     1854    6656   46069 fns.c
  4258.      606    1743   13957 free-hook.c
  4259.     1154    4849   34011 gmalloc.c
  4260.      438    1295   10260 hash.c
  4261.      898    3406   25386 indent.c
  4262.      642    2208   15464 insdel.c
  4263.     1271    4773   35191 keyboard.c
  4264.     2828   11260   87787 keymap.c
  4265.       38     255    1464 lastfile.c
  4266.      489    1810   10622 libsst.c
  4267.     1578    5464   39596 lread.c
  4268.      343    1177    9735 macros.c
  4269.      895    4257   25043 malloc.c
  4270.      312    1084    7945 marker.c
  4271.      941    3576   28123 menubar.c
  4272.       92     310    2368 menuitems.c
  4273.     1391    5090   42280 minibuf.c
  4274.      243     850    6078 mocklisp.c
  4275.      241     745    5162 play.c
  4276.        9      70     398 pre-crt0.c
  4277.     1157    3873   31600 print.c
  4278.     2439    8866   65634 process.c
  4279.      419    1359    9626 ralloc.c
  4280.      150     596    4512 realpath.c
  4281.     1715    6664   44455 regex.c
  4282.     1185    3743   30745 screen.c
  4283.      618    2681   19707 scroll.c
  4284.     1321    5852   38557 search.c
  4285.       20      97     569 sunOS-fix.c
  4286.      501    1770   13955 sunfns.c
  4287.     1255    4553   33716 syntax.c
  4288.     3742   12786   86731 sysdep.c
  4289.     1476    4931   39070 term.c
  4290.      672    2365   14167 termcap.c
  4291.       50     274    1717 terminfo.c
  4292.      275    1133    6768 tparam.c
  4293.      301    1142    8200 undo.c
  4294.      809    3347   21994 unexconvex.c
  4295.      855    3498   23421 unexec.c
  4296.      625    2733   22706 unexelf.c
  4297.      116     375    3198 unexencap.c
  4298.      262    1086    7723 unexenix.c
  4299.      293    1215    9003 unexhp9k800.c
  4300.      290    1065    8585 unexmips.c
  4301.      294    1263    7858 unexsunos4.c
  4302.      126     439    3000 vm-limit.c
  4303.      242    1014    7117 vms-pp.c
  4304.      960    3610   26453 vmsfns.c
  4305.      224     893    6013 vmsmap.c
  4306.      786    2399   17633 vmsproc.c
  4307.     2734    9684   78257 window.c
  4308.     3860   13490  111868 xdisp.c
  4309.     2228    7365   63070 xfns.c
  4310.     1849    7090   57502 xselect.c
  4311.     2729    7694   73831 xterm.c
  4312.      158     548    4387 xutils.c
  4313.    91042  326028 2508090 total
  4314.